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
|
---|---|---|---|---|---|---|
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
β’ J / spanSingleton Rββ° d β€ 1 / spanSingleton Rββ° d * J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· | intro x hx | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· | Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x β (fun a => βa) (J / spanSingleton Rββ° d)
β’ x β (fun a => βa) (1 / spanSingleton Rββ° d * J) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
| dsimp only [val_eq_coe] at hx β’ | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x β β(J / spanSingleton Rββ° d)
β’ x β β(1 / spanSingleton Rββ° d * J) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
| rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : β y β β(spanSingleton Rββ° d), x * y β βJ
β’ x β β(1 / spanSingleton Rββ° d * J) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
| specialize hx d (mem_spanSingleton_self Rββ° d) | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x * d β βJ
β’ x β β(1 / spanSingleton Rββ° d * J) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
| have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x * d β βJ
β’ x = dβ»ΒΉ * (x * d) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by | field_simp | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by | Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x * d β βJ
h_xd : x = dβ»ΒΉ * (x * d)
β’ x β β(1 / spanSingleton Rββ° d * J) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
| rw [coe_mul, one_div_spanSingleton, h_xd] | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
x : K
hx : x * d β βJ
h_xd : x = dβ»ΒΉ * (x * d)
β’ dβ»ΒΉ * (x * d) β β(spanSingleton Rββ° dβ»ΒΉ) * βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
| exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
| Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
case neg.a
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
J : FractionalIdeal Rββ° K
d : K
hd : Β¬d = 0
h_spand : spanSingleton Rββ° d β 0
β’ 1 / spanSingleton Rββ° d * J β€ J / spanSingleton Rββ° d | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· | rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one] | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· | Mathlib.RingTheory.FractionalIdeal.1461_0.90B1BH8AtSmfl9S | @[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
β’ β a aI, a β 0 β§ I = spanSingleton Rββ° ((algebraMap Rβ K) a)β»ΒΉ * βaI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
| obtain β¨a_inv, nonzero, haβ© := I.isFractional | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzero : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
β’ β a aI, a β 0 β§ I = spanSingleton Rββ° ((algebraMap Rβ K) a)β»ΒΉ * βaI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
| have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
β’ β a aI, a β 0 β§ I = spanSingleton Rββ° ((algebraMap Rβ K) a)β»ΒΉ * βaI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
| have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
β’ β a aI, a β 0 β§ I = spanSingleton Rββ° ((algebraMap Rβ K) a)β»ΒΉ * βaI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
| refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ© | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
β’ x β I β
β y' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)),
x = ((algebraMap Rβ K) a_inv)β»ΒΉ * y' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· | intro hx | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· | Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
hx : x β I
β’ β y' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)),
x = ((algebraMap Rβ K) a_inv)β»ΒΉ * y' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
| obtain β¨x', hx'β© := ha x hx | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
hx : x β I
x' : Rβ
hx' : (algebraMap Rβ K) x' = a_inv β’ x
β’ β y' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)),
x = ((algebraMap Rβ K) a_inv)β»ΒΉ * y' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
| rw [Algebra.smul_def] at hx' | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
hx : x β I
x' : Rβ
hx' : (algebraMap Rβ K) x' = (algebraMap Rβ K) a_inv * x
β’ β y' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)),
x = ((algebraMap Rβ K) a_inv)β»ΒΉ * y' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
| refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β© | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1.intro.refine'_1
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
hx : x β I
x' : Rβ
hx' : (algebraMap Rβ K) x' = (algebraMap Rβ K) a_inv * x
β’ β y' β I, (Algebra.linearMap Rβ K) x' = (algebraMap Rβ K) a_inv * y' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· | exact β¨x, hx, hx'β© | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· | Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_1.intro.refine'_2
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
hx : x β I
x' : Rβ
hx' : (algebraMap Rβ K) x' = (algebraMap Rβ K) a_inv * x
β’ x = ((algebraMap Rβ K) a_inv)β»ΒΉ * (algebraMap Rβ K) x' | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· | rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul] | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· | Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_2
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x : K
β’ (β y' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)),
x = ((algebraMap Rβ K) a_inv)β»ΒΉ * y') β
x β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· | rintro β¨y, hy, rflβ© | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· | Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_2.intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
y : K
hy : y β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I))
β’ ((algebraMap Rβ K) a_inv)β»ΒΉ * y β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
| obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_2.intro.intro.intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x' : Rβ
hx' : x' β comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)
hy : (algebraMap Rβ K) x' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I))
β’ ((algebraMap Rβ K) a_inv)β»ΒΉ * (algebraMap Rβ K) x' β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
| obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx' | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_2.intro.intro.intro.intro.intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x' : Rβ
hx'β : x' β comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)
hy : (algebraMap Rβ K) x' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I))
y' : K
hy' : y' β I
hx' : (Algebra.linearMap Rβ K) x' = (algebraMap Rβ K) a_inv * y'
β’ ((algebraMap Rβ K) a_inv)β»ΒΉ * (algebraMap Rβ K) x' β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
| rw [Algebra.linearMap_apply] at hx' | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.refine'_2.intro.intro.intro.intro.intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
I : FractionalIdeal Rββ° K
a_inv : Rβ
nonzeroβ : a_inv β Rββ°
ha : β b β βI, IsInteger Rβ (a_inv β’ b)
nonzero : a_inv β 0
map_a_nonzero : (algebraMap Rβ K) a_inv β 0
x' : Rβ
hx'β : x' β comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I)
hy : (algebraMap Rβ K) x' β β(comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° ((algebraMap Rβ K) a_inv) * I))
y' : K
hy' : y' β I
hx' : (algebraMap Rβ K) x' = (algebraMap Rβ K) a_inv * y'
β’ ((algebraMap Rβ K) a_inv)β»ΒΉ * (algebraMap Rβ K) x' β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
| rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul] | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
| Mathlib.RingTheory.FractionalIdeal.1480_0.90B1BH8AtSmfl9S | theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
β’ IsPrincipal βI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
| obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.intro
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
β’ IsPrincipal βI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
| use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI) | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
case h
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
β’ βI = span R {((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)} | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
| suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
this : I = spanSingleton Rβ° (((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI))
β’ βI = span R {((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)} | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
| rw [spanSingleton] at this | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
this :
I =
{ val := span R {((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)},
property := (_ : IsFractional Rβ° (span R {((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)})) }
β’ βI = span R {((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)} | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
| exact congr_arg Subtype.val this | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
case h
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
β’ I = spanSingleton Rβ° (((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
| conv_lhs => rw [ha, β span_singleton_generator aI] | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
| I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | rw [ha, β span_singleton_generator aI] | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
| I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | rw [ha, β span_singleton_generator aI] | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
| I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | rw [ha, β span_singleton_generator aI] | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => | Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
case h
Rβ : Type u_1
instβΒΉΒ² : CommRing Rβ
S : Submonoid Rβ
P : Type u_2
instβΒΉΒΉ : CommRing P
instβΒΉβ° : Algebra Rβ P
loc : IsLocalization S P
Rβ : Type u_3
instββΉ : CommRing Rβ
K : Type u_4
instββΈ : Field K
instββ· : Algebra Rβ K
instββΆ : IsFractionRing Rβ K
instββ΅ : IsDomain Rβ
R : Type ?u.1581927
instββ΄ : CommRing R
instβΒ³ : IsDomain R
instβΒ² : IsPrincipalIdealRing R
instβΒΉ : Algebra R K
instβ : IsFractionRing R K
I : FractionalIdeal Rβ° K
a : R
aI : Ideal R
ha : I = spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * βaI
β’ spanSingleton Rβ° ((algebraMap R K) a)β»ΒΉ * β(span R {generator aI}) =
spanSingleton Rβ° (((algebraMap R K) a)β»ΒΉ * (algebraMap R K) (generator aI)) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
| rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton] | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
| Mathlib.RingTheory.FractionalIdeal.1503_0.90B1BH8AtSmfl9S | instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ (β {zI : P}, zI β I β zI β spanSingleton S x * J) β β zI β I, β zJ β J, x * zJ = zI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
| simp only [mem_singleton_mul, eq_comm] | theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
| Mathlib.RingTheory.FractionalIdeal.1515_0.90B1BH8AtSmfl9S | theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ spanSingleton S x * I β€ J β β z β I, x * z β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
| simp only [mul_le, mem_singleton_mul, mem_spanSingleton] | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
| Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ (β (i : P), (β z, z β’ x = i) β β j β I, i * j β J) β β z β I, x * z β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
| constructor | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
| Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
case mp
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ (β (i : P), (β z, z β’ x = i) β β j β I, i * j β J) β β z β I, x * z β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· | intro h zI hzI | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· | Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
case mp
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
h : β (i : P), (β z, z β’ x = i) β β j β I, i * j β J
zI : P
hzI : zI β I
β’ x * zI β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
| exact h x β¨1, one_smul _ _β© zI hzI | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
| Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
case mpr
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ (β z β I, x * z β J) β β (i : P), (β z, z β’ x = i) β β j β I, i * j β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· | rintro h _ β¨z, rflβ© zI hzI | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· | Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
case mpr.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
h : β z β I, x * z β J
z : R
zI : P
hzI : zI β I
β’ z β’ x * zI β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
| rw [Algebra.smul_mul_assoc] | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
| Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
case mpr.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
h : β z β I, x * z β J
z : R
zI : P
hzI : zI β I
β’ z β’ (x * zI) β J | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
| exact Submodule.smul_mem J.1 _ (h zI hzI) | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
| Mathlib.RingTheory.FractionalIdeal.1521_0.90B1BH8AtSmfl9S | theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
instβΒΉ : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : P
I J : FractionalIdeal S P
β’ I = spanSingleton S x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
| simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff] | theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
| Mathlib.RingTheory.FractionalIdeal.1532_0.90B1BH8AtSmfl9S | theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ΅ : CommRing R
S : Submonoid R
P : Type u_2
instββ΄ : CommRing P
instβΒ³ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ² : CommRing Rβ
K : Type u_4
instβΒΉ : Field K
instβ : Algebra Rβ K
frac : IsFractionRing Rβ K
I : Submodule Rβ K
hI : I β€ β0
β’ FG I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
| rw [coe_zero, le_bot_iff] at hI | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
| Mathlib.RingTheory.FractionalIdeal.1545_0.90B1BH8AtSmfl9S | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ΅ : CommRing R
S : Submonoid R
P : Type u_2
instββ΄ : CommRing P
instβΒ³ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ² : CommRing Rβ
K : Type u_4
instβΒΉ : Field K
instβ : Algebra Rβ K
frac : IsFractionRing Rβ K
I : Submodule Rβ K
hI : I = β₯
β’ FG I | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
| rw [hI] | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
| Mathlib.RingTheory.FractionalIdeal.1545_0.90B1BH8AtSmfl9S | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ΅ : CommRing R
S : Submonoid R
P : Type u_2
instββ΄ : CommRing P
instβΒ³ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ² : CommRing Rβ
K : Type u_4
instβΒΉ : Field K
instβ : Algebra Rβ K
frac : IsFractionRing Rβ K
I : Submodule Rβ K
hI : I = β₯
β’ FG β₯ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
| exact fg_bot | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
| Mathlib.RingTheory.FractionalIdeal.1545_0.90B1BH8AtSmfl9S | theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsNoetherianRing Rβ
I : Ideal Rβ
β’ IsNoetherian Rβ β₯ββI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
| rw [isNoetherian_iff] | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
| Mathlib.RingTheory.FractionalIdeal.1557_0.90B1BH8AtSmfl9S | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsNoetherianRing Rβ
I : Ideal Rβ
β’ β J β€ βI, FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
| intro J hJ | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
| Mathlib.RingTheory.FractionalIdeal.1557_0.90B1BH8AtSmfl9S | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsNoetherianRing Rβ
I : Ideal Rβ
J : FractionalIdeal Rββ° K
hJ : J β€ βI
β’ FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
| obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one) | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
| Mathlib.RingTheory.FractionalIdeal.1557_0.90B1BH8AtSmfl9S | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case intro
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsNoetherianRing Rβ
I J : Ideal Rβ
hJ : βJ β€ βI
β’ FG ββJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
| exact (IsNoetherian.noetherian J).map _ | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
| Mathlib.RingTheory.FractionalIdeal.1557_0.90B1BH8AtSmfl9S | theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
| by_cases hx : x = 0 | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case pos
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
hx : x = 0
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· | rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul] | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· | Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case pos
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
hx : x = 0
β’ IsNoetherian Rβ β₯β0 | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
| exact isNoetherian_zero | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
hx : Β¬x = 0
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
| have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
| have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : IsNoetherian Rβ β₯βI
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
| rw [isNoetherian_iff] at hI β’ | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : β J β€ I, FG βJ
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
β’ β J β€ spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I, FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
| intro J hJ | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : β J β€ I, FG βJ
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
J : FractionalIdeal Rββ° K
hJ : J β€ spanSingleton Rββ° ((algebraMap Rβ K) x)β»ΒΉ * I
β’ FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
| rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : β J β€ I, FG βJ
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
J : FractionalIdeal Rββ° K
hJ : J * spanSingleton Rββ° ((algebraMap Rβ K) x) β€ I
β’ FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
| obtain β¨s, hsβ© := hI _ hJ | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case neg.intro
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : β J β€ I, FG βJ
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
J : FractionalIdeal Rββ° K
hJ : J * spanSingleton Rββ° ((algebraMap Rβ K) x) β€ I
s : Finset K
hs : span Rβ βs = β(J * spanSingleton Rββ° ((algebraMap Rβ K) x))
β’ FG βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
| use s * {(algebraMap Rβ K x)β»ΒΉ} | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
case h
R : Type u_1
instββΆ : CommRing R
S : Submonoid R
P : Type u_2
instββ΅ : CommRing P
instββ΄ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instβΒ³ : CommRing Rβ
K : Type u_4
instβΒ² : Field K
instβΒΉ : Algebra Rβ K
frac : IsFractionRing Rβ K
instβ : IsDomain Rβ
x : Rβ
I : FractionalIdeal Rββ° K
hI : β J β€ I, FG βJ
hx : Β¬x = 0
h_gx : (algebraMap Rβ K) x β 0
h_spanx : spanSingleton Rββ° ((algebraMap Rβ K) x) β 0
J : FractionalIdeal Rββ° K
hJ : J * spanSingleton Rββ° ((algebraMap Rβ K) x) β€ I
s : Finset K
hs : span Rβ βs = β(J * spanSingleton Rββ° ((algebraMap Rβ K) x))
β’ span Rβ β(s * {((algebraMap Rβ K) x)β»ΒΉ}) = βJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
use s * {(algebraMap Rβ K x)β»ΒΉ}
| rw [Finset.coe_mul, Finset.coe_singleton, β span_mul_span, hs, β coe_spanSingleton Rββ°, β
coe_mul, mul_assoc, spanSingleton_mul_spanSingleton, mul_inv_cancel h_gx, spanSingleton_one,
mul_one] | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
use s * {(algebraMap Rβ K x)β»ΒΉ}
| Mathlib.RingTheory.FractionalIdeal.1567_0.90B1BH8AtSmfl9S | theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) | Mathlib_RingTheory_FractionalIdeal |
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
frac : IsFractionRing Rβ K
instβΒΉ : IsDomain Rβ
instβ : IsNoetherianRing Rβ
I : FractionalIdeal Rββ° K
β’ IsNoetherian Rβ β₯βI | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
use s * {(algebraMap Rβ K x)β»ΒΉ}
rw [Finset.coe_mul, Finset.coe_singleton, β span_mul_span, hs, β coe_spanSingleton Rββ°, β
coe_mul, mul_assoc, spanSingleton_mul_spanSingleton, mul_inv_cancel h_gx, spanSingleton_one,
mul_one]
#align fractional_ideal.is_noetherian_span_singleton_inv_to_map_mul FractionalIdeal.isNoetherian_spanSingleton_inv_to_map_mul
/-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
| obtain β¨d, J, _, rflβ© := exists_eq_spanSingleton_mul I | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
| Mathlib.RingTheory.FractionalIdeal.1586_0.90B1BH8AtSmfl9S | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.intro
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
frac : IsFractionRing Rβ K
instβΒΉ : IsDomain Rβ
instβ : IsNoetherianRing Rβ
d : Rβ
J : Ideal Rβ
leftβ : d β 0
β’ IsNoetherian Rβ β₯β(spanSingleton Rββ° ((algebraMap Rβ K) d)β»ΒΉ * βJ) | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
use s * {(algebraMap Rβ K x)β»ΒΉ}
rw [Finset.coe_mul, Finset.coe_singleton, β span_mul_span, hs, β coe_spanSingleton Rββ°, β
coe_mul, mul_assoc, spanSingleton_mul_spanSingleton, mul_inv_cancel h_gx, spanSingleton_one,
mul_one]
#align fractional_ideal.is_noetherian_span_singleton_inv_to_map_mul FractionalIdeal.isNoetherian_spanSingleton_inv_to_map_mul
/-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
obtain β¨d, J, _, rflβ© := exists_eq_spanSingleton_mul I
| apply isNoetherian_spanSingleton_inv_to_map_mul | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
obtain β¨d, J, _, rflβ© := exists_eq_spanSingleton_mul I
| Mathlib.RingTheory.FractionalIdeal.1586_0.90B1BH8AtSmfl9S | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I | Mathlib_RingTheory_FractionalIdeal |
case intro.intro.intro.hI
R : Type u_1
instββ· : CommRing R
S : Submonoid R
P : Type u_2
instββΆ : CommRing P
instββ΅ : Algebra R P
loc : IsLocalization S P
Rβ : Type u_3
instββ΄ : CommRing Rβ
K : Type u_4
instβΒ³ : Field K
instβΒ² : Algebra Rβ K
frac : IsFractionRing Rβ K
instβΒΉ : IsDomain Rβ
instβ : IsNoetherianRing Rβ
d : Rβ
J : Ideal Rβ
leftβ : d β 0
β’ IsNoetherian Rβ β₯ββJ | /-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Filippo A. E. Nuccio
-/
import Mathlib.Algebra.BigOperators.Finprod
import Mathlib.RingTheory.IntegralClosure
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Noetherian
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Tactic.FieldSimp
#align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7"
/-!
# Fractional ideals
This file defines fractional ideals of an integral domain and proves basic facts about them.
## Main definitions
Let `S` be a submonoid of an integral domain `R`, `P` the localization of `R` at `S`, and `f` the
natural ring hom from `R` to `P`.
* `IsFractional` defines which `R`-submodules of `P` are fractional ideals
* `FractionalIdeal S P` is the type of fractional ideals in `P`
* a coercion `coeIdeal : Ideal R β FractionalIdeal S P`
* `CommSemiring (FractionalIdeal S P)` instance:
the typical ideal operations generalized to fractional ideals
* `Lattice (FractionalIdeal S P)` instance
* `map` is the pushforward of a fractional ideal along an algebra morphism
Let `K` be the localization of `R` at `Rβ° = R \ {0}` (i.e. the field of fractions).
* `FractionalIdeal Rβ° K` is the type of fractional ideals in the field of fractions
* `Div (FractionalIdeal Rβ° K)` instance:
the ideal quotient `I / J` (typically written $I : J$, but a `:` operator cannot be defined)
## Main statements
* `mul_left_mono` and `mul_right_mono` state that ideal multiplication is monotone
* `mul_div_self_cancel_iff` states that `1 / I` is the inverse of `I` if one exists
* `isNoetherian` states that every fractional ideal of a noetherian integral domain is noetherian
## Implementation notes
Fractional ideals are considered equal when they contain the same elements,
independent of the denominator `a : R` such that `a I β R`.
Thus, we define `FractionalIdeal` to be the subtype of the predicate `IsFractional`,
instead of having `FractionalIdeal` be a structure of which `a` is a field.
Most definitions in this file specialize operations from submodules to fractional ideals,
proving that the result of this operation is fractional if the input is fractional.
Exceptions to this rule are defining `(+) := (β)` and `β₯ := 0`,
in order to re-use their respective proof terms.
We can still use `simp` to show `βI + βJ = β(I + J)` and `ββ₯ = β0`.
Many results in fact do not need that `P` is a localization, only that `P` is an
`R`-algebra. We omit the `IsLocalization` parameter whenever this is practical.
Similarly, we don't assume that the localization is a field until we need it to
define ideal quotients. When this assumption is needed, we replace `S` with `Rβ°`,
making the localization a field.
## References
* https://en.wikipedia.org/wiki/Fractional_ideal
## Tags
fractional ideal, fractional ideals, invertible ideal
-/
open IsLocalization
open Pointwise
open nonZeroDivisors
section Defs
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P]
variable (S)
/-- A submodule `I` is a fractional ideal if `a I β R` for some `a β 0`. -/
def IsFractional (I : Submodule R P) :=
β a β S, β b β I, IsInteger R (a β’ b)
#align is_fractional IsFractional
variable (P)
/-- The fractional ideals of a domain `R` are ideals of `R` divided by some `a β R`.
More precisely, let `P` be a localization of `R` at some submonoid `S`,
then a fractional ideal `I β P` is an `R`-submodule of `P`,
such that there is a nonzero `a : R` with `a I β R`.
-/
def FractionalIdeal :=
{ I : Submodule R P // IsFractional S I }
#align fractional_ideal FractionalIdeal
end Defs
namespace FractionalIdeal
open Set
open Submodule
variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P]
variable [Algebra R P] [loc : IsLocalization S P]
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This implements the coercion `FractionalIdeal S P β Submodule R P`.
-/
@[coe]
def coeToSubmodule (I : FractionalIdeal S P) : Submodule R P :=
I.val
/-- Map a fractional ideal `I` to a submodule by forgetting that `β a, a I β R`.
This coercion is typically called `coeToSubmodule` in lemma names
(or `coe` when the coercion is clear from the context),
not to be confused with `IsLocalization.coeSubmodule : Ideal R β Submodule R P`
(which we use to define `coe : Ideal R β FractionalIdeal S P`).
-/
instance : CoeOut (FractionalIdeal S P) (Submodule R P) :=
β¨coeToSubmoduleβ©
protected theorem isFractional (I : FractionalIdeal S P) : IsFractional S (I : Submodule R P) :=
I.prop
#align fractional_ideal.is_fractional FractionalIdeal.isFractional
section SetLike
instance : SetLike (FractionalIdeal S P) P where
coe I := β(I : Submodule R P)
coe_injective' := SetLike.coe_injective.comp Subtype.coe_injective
@[simp]
theorem mem_coe {I : FractionalIdeal S P} {x : P} : x β (I : Submodule R P) β x β I :=
Iff.rfl
#align fractional_ideal.mem_coe FractionalIdeal.mem_coe
@[ext]
theorem ext {I J : FractionalIdeal S P} : (β x, x β I β x β J) β I = J :=
SetLike.ext
#align fractional_ideal.ext FractionalIdeal.ext
/-- Copy of a `FractionalIdeal` with a new underlying set equal to the old one.
Useful to fix definitional equalities. -/
protected def copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : FractionalIdeal S P :=
β¨Submodule.copy p s hs, by
convert p.isFractional
ext
simp only [hs]
rflβ©
#align fractional_ideal.copy FractionalIdeal.copy
@[simp]
theorem coe_copy (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : β(p.copy s hs) = s :=
rfl
#align fractional_ideal.coe_copy FractionalIdeal.coe_copy
theorem coe_eq (p : FractionalIdeal S P) (s : Set P) (hs : s = βp) : p.copy s hs = p :=
SetLike.coe_injective hs
#align fractional_ideal.coe_eq FractionalIdeal.coe_eq
end SetLike
-- Porting note: this seems to be needed a lot more than in Lean 3
@[simp]
theorem val_eq_coe (I : FractionalIdeal S P) : I.val = I :=
rfl
#align fractional_ideal.val_eq_coe FractionalIdeal.val_eq_coe
-- Porting note: had to rephrase this to make it clear to `simp` what was going on.
@[simp, norm_cast]
theorem coe_mk (I : Submodule R P) (hI : IsFractional S I) :
coeToSubmodule β¨I, hIβ© = I :=
rfl
#align fractional_ideal.coe_mk FractionalIdeal.coe_mk
-- Porting note: added this lemma because Lean can't see through the composition of coercions.
theorem coeToSet_coeToSubmodule (I : FractionalIdeal S P) :
((I : Submodule R P) : Set P) = I :=
rfl
/-! Transfer instances from `Submodule R P` to `FractionalIdeal S P`. -/
instance (I : FractionalIdeal S P) : Module R I :=
Submodule.module (I : Submodule R P)
theorem coeToSubmodule_injective :
Function.Injective (fun (I : FractionalIdeal S P) β¦ (I : Submodule R P)) :=
Subtype.coe_injective
#align fractional_ideal.coe_to_submodule_injective FractionalIdeal.coeToSubmodule_injective
theorem coeToSubmodule_inj {I J : FractionalIdeal S P} : (I : Submodule R P) = J β I = J :=
coeToSubmodule_injective.eq_iff
#align fractional_ideal.coe_to_submodule_inj FractionalIdeal.coeToSubmodule_inj
theorem isFractional_of_le_one (I : Submodule R P) (h : I β€ 1) : IsFractional S I := by
use 1, S.one_mem
intro b hb
rw [one_smul]
obtain β¨b', b'_mem, rflβ© := h hb
exact Set.mem_range_self b'
#align fractional_ideal.is_fractional_of_le_one FractionalIdeal.isFractional_of_le_one
theorem isFractional_of_le {I : Submodule R P} {J : FractionalIdeal S P} (hIJ : I β€ J) :
IsFractional S I := by
obtain β¨a, a_mem, haβ© := J.isFractional
use a, a_mem
intro b b_mem
exact ha b (hIJ b_mem)
#align fractional_ideal.is_fractional_of_le FractionalIdeal.isFractional_of_le
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is the function that implements the coercion `Ideal R β FractionalIdeal S P`. -/
@[coe]
def coeIdeal (I : Ideal R) : FractionalIdeal S P :=
β¨coeSubmodule P I,
isFractional_of_le_one _ <| by simpa using coeSubmodule_mono P (le_top : I β€ β€)β©
-- Is a `CoeTC` rather than `Coe` to speed up failing inference, see library note [use has_coe_t]
/-- Map an ideal `I` to a fractional ideal by forgetting `I` is integral.
This is a bundled version of `IsLocalization.coeSubmodule : Ideal R β Submodule R P`,
which is not to be confused with the `coe : FractionalIdeal S P β Submodule R P`,
also called `coeToSubmodule` in theorem names.
This map is available as a ring hom, called `FractionalIdeal.coeIdealHom`.
-/
instance : CoeTC (Ideal R) (FractionalIdeal S P) :=
β¨fun I => coeIdeal Iβ©
@[simp, norm_cast]
theorem coe_coeIdeal (I : Ideal R) :
((I : FractionalIdeal S P) : Submodule R P) = coeSubmodule P I :=
rfl
#align fractional_ideal.coe_coe_ideal FractionalIdeal.coe_coeIdeal
variable (S)
@[simp]
theorem mem_coeIdeal {x : P} {I : Ideal R} :
x β (I : FractionalIdeal S P) β β x', x' β I β§ algebraMap R P x' = x :=
mem_coeSubmodule _ _
#align fractional_ideal.mem_coe_ideal FractionalIdeal.mem_coeIdeal
theorem mem_coeIdeal_of_mem {x : R} {I : Ideal R} (hx : x β I) :
algebraMap R P x β (I : FractionalIdeal S P) :=
(mem_coeIdeal S).mpr β¨x, hx, rflβ©
#align fractional_ideal.mem_coe_ideal_of_mem FractionalIdeal.mem_coeIdeal_of_mem
theorem coeIdeal_le_coeIdeal' [IsLocalization S P] (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) β€ J β I β€ J :=
coeSubmodule_le_coeSubmodule h
#align fractional_ideal.coe_ideal_le_coe_ideal' FractionalIdeal.coeIdeal_le_coeIdeal'
@[simp]
theorem coeIdeal_le_coeIdeal (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
{I J : Ideal R} : (I : FractionalIdeal Rβ° K) β€ J β I β€ J :=
IsFractionRing.coeSubmodule_le_coeSubmodule
#align fractional_ideal.coe_ideal_le_coe_ideal FractionalIdeal.coeIdeal_le_coeIdeal
instance : Zero (FractionalIdeal S P) :=
β¨(0 : Ideal R)β©
@[simp]
theorem mem_zero_iff {x : P} : x β (0 : FractionalIdeal S P) β x = 0 :=
β¨fun β¨x', x'_mem_zero, x'_eq_xβ© => by
have x'_eq_zero : x' = 0 := x'_mem_zero
simp [x'_eq_x.symm, x'_eq_zero], fun hx => β¨0, rfl, by simp [hx]β©β©
#align fractional_ideal.mem_zero_iff FractionalIdeal.mem_zero_iff
variable {S}
@[simp, norm_cast]
theorem coe_zero : β(0 : FractionalIdeal S P) = (β₯ : Submodule R P) :=
Submodule.ext fun _ => mem_zero_iff S
#align fractional_ideal.coe_zero FractionalIdeal.coe_zero
@[simp, norm_cast]
theorem coeIdeal_bot : ((β₯ : Ideal R) : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.coe_ideal_bot FractionalIdeal.coeIdeal_bot
variable (P)
@[simp]
theorem exists_mem_algebraMap_eq {x : R} {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(β x', x' β I β§ algebraMap R P x' = algebraMap R P x) β x β I :=
β¨fun β¨_, hx', Eqβ© => IsLocalization.injective _ h Eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.exists_mem_to_map_eq FractionalIdeal.exists_mem_algebraMap_eq
variable {P}
theorem coeIdeal_injective' (h : S β€ nonZeroDivisors R) :
Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal S P)) := fun _ _ h' =>
((coeIdeal_le_coeIdeal' S h).mp h'.le).antisymm ((coeIdeal_le_coeIdeal' S h).mp
h'.ge)
#align fractional_ideal.coe_ideal_injective' FractionalIdeal.coeIdeal_injective'
theorem coeIdeal_inj' (h : S β€ nonZeroDivisors R) {I J : Ideal R} :
(I : FractionalIdeal S P) = J β I = J :=
(coeIdeal_injective' h).eq_iff
#align fractional_ideal.coe_ideal_inj' FractionalIdeal.coeIdeal_inj'
-- Porting note: doesn't need to be @[simp] because it can be proved by coeIdeal_eq_zero
theorem coeIdeal_eq_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) = 0 β I = (β₯ : Ideal R) :=
coeIdeal_inj' h
#align fractional_ideal.coe_ideal_eq_zero' FractionalIdeal.coeIdeal_eq_zero'
theorem coeIdeal_ne_zero' {I : Ideal R} (h : S β€ nonZeroDivisors R) :
(I : FractionalIdeal S P) β 0 β I β (β₯ : Ideal R) :=
not_iff_not.mpr <| coeIdeal_eq_zero' h
#align fractional_ideal.coe_ideal_ne_zero' FractionalIdeal.coeIdeal_ne_zero'
theorem coeToSubmodule_eq_bot {I : FractionalIdeal S P} : (I : Submodule R P) = β₯ β I = 0 :=
β¨fun h => coeToSubmodule_injective (by simp [h]), fun h => by simp [h]β©
#align fractional_ideal.coe_to_submodule_eq_bot FractionalIdeal.coeToSubmodule_eq_bot
theorem coeToSubmodule_ne_bot {I : FractionalIdeal S P} : βI β (β₯ : Submodule R P) β I β 0 :=
not_iff_not.mpr coeToSubmodule_eq_bot
#align fractional_ideal.coe_to_submodule_ne_bot FractionalIdeal.coeToSubmodule_ne_bot
instance : Inhabited (FractionalIdeal S P) :=
β¨0β©
instance : One (FractionalIdeal S P) :=
β¨(β€ : Ideal R)β©
variable (S)
@[simp, norm_cast]
theorem coeIdeal_top : ((β€ : Ideal R) : FractionalIdeal S P) = 1 :=
rfl
#align fractional_ideal.coe_ideal_top FractionalIdeal.coeIdeal_top
theorem mem_one_iff {x : P} : x β (1 : FractionalIdeal S P) β β x' : R, algebraMap R P x' = x :=
Iff.intro (fun β¨x', _, hβ© => β¨x', hβ©) fun β¨x', hβ© => β¨x', β¨β©, hβ©
#align fractional_ideal.mem_one_iff FractionalIdeal.mem_one_iff
theorem coe_mem_one (x : R) : algebraMap R P x β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨x, rflβ©
#align fractional_ideal.coe_mem_one FractionalIdeal.coe_mem_one
theorem one_mem_one : (1 : P) β (1 : FractionalIdeal S P) :=
(mem_one_iff S).mpr β¨1, RingHom.map_one _β©
#align fractional_ideal.one_mem_one FractionalIdeal.one_mem_one
variable {S}
/-- `(1 : FractionalIdeal S P)` is defined as the R-submodule `f(R) β€ P`.
However, this is not definitionally equal to `1 : Submodule R P`,
which is proved in the actual `simp` lemma `coe_one`. -/
theorem coe_one_eq_coeSubmodule_top : β(1 : FractionalIdeal S P) = coeSubmodule P (β€ : Ideal R) :=
rfl
#align fractional_ideal.coe_one_eq_coe_submodule_top FractionalIdeal.coe_one_eq_coeSubmodule_top
@[simp, norm_cast]
theorem coe_one : (β(1 : FractionalIdeal S P) : Submodule R P) = 1 := by
rw [coe_one_eq_coeSubmodule_top, coeSubmodule_top]
#align fractional_ideal.coe_one FractionalIdeal.coe_one
section Lattice
/-!
### `Lattice` section
Defines the order on fractional ideals as inclusion of their underlying sets,
and ports the lattice structure on submodules to fractional ideals.
-/
@[simp]
theorem coe_le_coe {I J : FractionalIdeal S P} :
(I : Submodule R P) β€ (J : Submodule R P) β I β€ J :=
Iff.rfl
#align fractional_ideal.coe_le_coe FractionalIdeal.coe_le_coe
theorem zero_le (I : FractionalIdeal S P) : 0 β€ I := by
intro x hx
-- Porting note: changed the proof from convert; simp into rw; exact
rw [(mem_zero_iff _).mp hx]
exact zero_mem (I : Submodule R P)
#align fractional_ideal.zero_le FractionalIdeal.zero_le
instance orderBot : OrderBot (FractionalIdeal S P) where
bot := 0
bot_le := zero_le
#align fractional_ideal.order_bot FractionalIdeal.orderBot
@[simp]
theorem bot_eq_zero : (β₯ : FractionalIdeal S P) = 0 :=
rfl
#align fractional_ideal.bot_eq_zero FractionalIdeal.bot_eq_zero
@[simp]
theorem le_zero_iff {I : FractionalIdeal S P} : I β€ 0 β I = 0 :=
le_bot_iff
#align fractional_ideal.le_zero_iff FractionalIdeal.le_zero_iff
theorem eq_zero_iff {I : FractionalIdeal S P} : I = 0 β β x β I, x = (0 : P) :=
β¨fun h x hx => by simpa [h, mem_zero_iff] using hx, fun h =>
le_bot_iff.mp fun x hx => (mem_zero_iff S).mpr (h x hx)β©
#align fractional_ideal.eq_zero_iff FractionalIdeal.eq_zero_iff
theorem _root_.IsFractional.sup {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I β J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
rcases mem_sup.mp hb with β¨bI, hbI, bJ, hbJ, rflβ©
rw [smul_add]
apply isInteger_add
Β· rw [mul_smul, smul_comm]
exact isInteger_smul (hI bI hbI)
Β· rw [mul_smul]
exact isInteger_smul (hJ bJ hbJ)β©
#align is_fractional.sup IsFractional.sup
theorem _root_.IsFractional.inf_right {I : Submodule R P} :
IsFractional S I β β J, IsFractional S (I β J)
| β¨aI, haI, hIβ©, J =>
β¨aI, haI, fun b hb => by
rcases mem_inf.mp hb with β¨hbI, _β©
exact hI b hbIβ©
#align is_fractional.inf_right IsFractional.inf_right
instance : Inf (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.inf_right Jβ©β©
@[simp, norm_cast]
theorem coe_inf (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_inf FractionalIdeal.coe_inf
instance : Sup (FractionalIdeal S P) :=
β¨fun I J => β¨I β J, I.isFractional.sup J.isFractionalβ©β©
@[norm_cast]
theorem coe_sup (I J : FractionalIdeal S P) : β(I β J) = (I β J : Submodule R P) :=
rfl
#align fractional_ideal.coe_sup FractionalIdeal.coe_sup
instance lattice : Lattice (FractionalIdeal S P) :=
Function.Injective.lattice _ Subtype.coe_injective coe_sup coe_inf
#align fractional_ideal.lattice FractionalIdeal.lattice
instance : SemilatticeSup (FractionalIdeal S P) :=
{ FractionalIdeal.lattice with }
end Lattice
section Semiring
instance : Add (FractionalIdeal S P) :=
β¨(Β· β Β·)β©
@[simp]
theorem sup_eq_add (I J : FractionalIdeal S P) : I β J = I + J :=
rfl
#align fractional_ideal.sup_eq_add FractionalIdeal.sup_eq_add
@[simp, norm_cast]
theorem coe_add (I J : FractionalIdeal S P) : (β(I + J) : Submodule R P) = I + J :=
rfl
#align fractional_ideal.coe_add FractionalIdeal.coe_add
@[simp, norm_cast]
theorem coeIdeal_sup (I J : Ideal R) : β(I β J) = (I + J : FractionalIdeal S P) :=
coeToSubmodule_injective <| coeSubmodule_sup _ _ _
#align fractional_ideal.coe_ideal_sup FractionalIdeal.coeIdeal_sup
theorem _root_.IsFractional.nsmul {I : Submodule R P} :
β n : β, IsFractional S I β IsFractional S (n β’ I : Submodule R P)
| 0, _ => by
rw [zero_smul]
convert ((0 : Ideal R) : FractionalIdeal S P).isFractional
simp
| n + 1, h => by
rw [succ_nsmul]
exact h.sup (IsFractional.nsmul n h)
#align is_fractional.nsmul IsFractional.nsmul
instance : SMul β (FractionalIdeal S P) where smul n I := β¨n β’ βI, I.isFractional.nsmul nβ©
@[norm_cast]
theorem coe_nsmul (n : β) (I : FractionalIdeal S P) :
(β(n β’ I) : Submodule R P) = n β’ (I : Submodule R P) :=
rfl
#align fractional_ideal.coe_nsmul FractionalIdeal.coe_nsmul
theorem _root_.IsFractional.mul {I J : Submodule R P} :
IsFractional S I β IsFractional S J β IsFractional S (I * J : Submodule R P)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ© =>
β¨aI * aJ, S.mul_mem haI haJ, fun b hb => by
refine Submodule.mul_induction_on hb ?_ ?_
Β· intro m hm n hn
obtain β¨n', hn'β© := hJ n hn
rw [mul_smul, mul_comm m, β smul_mul_assoc, β hn', β Algebra.smul_def]
apply hI
exact Submodule.smul_mem _ _ hm
Β· intro x y hx hy
rw [smul_add]
apply isInteger_add hx hyβ©
#align is_fractional.mul IsFractional.mul
theorem _root_.IsFractional.pow {I : Submodule R P} (h : IsFractional S I) :
β n : β, IsFractional S (I ^ n : Submodule R P)
| 0 => isFractional_of_le_one _ (pow_zero _).le
| n + 1 => (pow_succ I n).symm βΈ h.mul (IsFractional.pow h n)
#align is_fractional.pow IsFractional.pow
/-- `FractionalIdeal.mul` is the product of two fractional ideals,
used to define the `Mul` instance.
This is only an auxiliary definition: the preferred way of writing `I.mul J` is `I * J`.
Elaborated terms involving `FractionalIdeal` tend to grow quite large,
so by making definitions irreducible, we hope to avoid deep unfolds.
-/
irreducible_def mul (lemma := mul_def') (I J : FractionalIdeal S P) : FractionalIdeal S P :=
β¨I * J, I.isFractional.mul J.isFractionalβ©
#align fractional_ideal.mul FractionalIdeal.mul
-- local attribute [semireducible] mul
instance : Mul (FractionalIdeal S P) :=
β¨fun I J => mul I Jβ©
@[simp]
theorem mul_eq_mul (I J : FractionalIdeal S P) : mul I J = I * J :=
rfl
#align fractional_ideal.mul_eq_mul FractionalIdeal.mul_eq_mul
theorem mul_def (I J : FractionalIdeal S P) : I * J = β¨I * J, I.isFractional.mul J.isFractionalβ© :=
by simp only [β mul_eq_mul, mul]
#align fractional_ideal.mul_def FractionalIdeal.mul_def
@[simp, norm_cast]
theorem coe_mul (I J : FractionalIdeal S P) : (β(I * J) : Submodule R P) = I * J := by
simp only [mul_def, coe_mk]
#align fractional_ideal.coe_mul FractionalIdeal.coe_mul
@[simp, norm_cast]
theorem coeIdeal_mul (I J : Ideal R) : (β(I * J) : FractionalIdeal S P) = I * J := by
simp only [mul_def]
exact coeToSubmodule_injective (coeSubmodule_mul _ _ _)
#align fractional_ideal.coe_ideal_mul FractionalIdeal.coeIdeal_mul
theorem mul_left_mono (I : FractionalIdeal S P) : Monotone (I * Β·) := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul hx (h hy)
#align fractional_ideal.mul_left_mono FractionalIdeal.mul_left_mono
theorem mul_right_mono (I : FractionalIdeal S P) : Monotone fun J => J * I := by
intro J J' h
simp only [mul_def]
exact mul_le.mpr fun x hx y hy => mul_mem_mul (h hx) hy
#align fractional_ideal.mul_right_mono FractionalIdeal.mul_right_mono
theorem mul_mem_mul {I J : FractionalIdeal S P} {i j : P} (hi : i β I) (hj : j β J) :
i * j β I * J := by
simp only [mul_def]
exact Submodule.mul_mem_mul hi hj
#align fractional_ideal.mul_mem_mul FractionalIdeal.mul_mem_mul
theorem mul_le {I J K : FractionalIdeal S P} : I * J β€ K β β i β I, β j β J, i * j β K := by
simp only [mul_def]
exact Submodule.mul_le
#align fractional_ideal.mul_le FractionalIdeal.mul_le
instance : Pow (FractionalIdeal S P) β :=
β¨fun I n => β¨(I : Submodule R P) ^ n, I.isFractional.pow nβ©β©
@[simp, norm_cast]
theorem coe_pow (I : FractionalIdeal S P) (n : β) : β(I ^ n) = (I : Submodule R P) ^ n :=
rfl
#align fractional_ideal.coe_pow FractionalIdeal.coe_pow
@[elab_as_elim]
protected theorem mul_induction_on {I J : FractionalIdeal S P} {C : P β Prop} {r : P}
(hr : r β I * J) (hm : β i β I, β j β J, C (i * j)) (ha : β x y, C x β C y β C (x + y)) :
C r := by
simp only [mul_def] at hr
exact Submodule.mul_induction_on hr hm ha
#align fractional_ideal.mul_induction_on FractionalIdeal.mul_induction_on
instance : NatCast (FractionalIdeal S P) :=
β¨Nat.unaryCastβ©
theorem coe_nat_cast (n : β) : ((n : FractionalIdeal S P) : Submodule R P) = n :=
show ((n.unaryCast : FractionalIdeal S P) : Submodule R P) = n
by induction n <;> simp [*, Nat.unaryCast]
#align fractional_ideal.coe_nat_cast FractionalIdeal.coe_nat_cast
instance commSemiring : CommSemiring (FractionalIdeal S P) :=
Function.Injective.commSemiring _ Subtype.coe_injective coe_zero coe_one coe_add coe_mul
(fun _ _ => coe_nsmul _ _) coe_pow coe_nat_cast
variable (S P)
/-- `FractionalIdeal.coeToSubmodule` as a bundled `RingHom`. -/
@[simps]
def coeSubmoduleHom : FractionalIdeal S P β+* Submodule R P where
toFun := coeToSubmodule
map_one' := coe_one
map_mul' := coe_mul
map_zero' := coe_zero (S := S)
map_add' := coe_add
#align fractional_ideal.coe_submodule_hom FractionalIdeal.coeSubmoduleHom
variable {S P}
section Order
theorem add_le_add_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' + I β€ J' + J :=
sup_le_sup_left hIJ J'
#align fractional_ideal.add_le_add_left FractionalIdeal.add_le_add_left
theorem mul_le_mul_left {I J : FractionalIdeal S P} (hIJ : I β€ J) (J' : FractionalIdeal S P) :
J' * I β€ J' * J :=
mul_le.mpr fun _ hk _ hj => mul_mem_mul hk (hIJ hj)
#align fractional_ideal.mul_le_mul_left FractionalIdeal.mul_le_mul_left
theorem le_self_mul_self {I : FractionalIdeal S P} (hI : 1 β€ I) : I β€ I * I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.le_self_mul_self FractionalIdeal.le_self_mul_self
theorem mul_self_le_self {I : FractionalIdeal S P} (hI : I β€ 1) : I * I β€ I := by
convert mul_left_mono I hI
exact (mul_one I).symm
#align fractional_ideal.mul_self_le_self FractionalIdeal.mul_self_le_self
theorem coeIdeal_le_one {I : Ideal R} : (I : FractionalIdeal S P) β€ 1 := fun _ hx =>
let β¨y, _, hyβ© := (mem_coeIdeal S).mp hx
(mem_one_iff S).mpr β¨y, hyβ©
#align fractional_ideal.coe_ideal_le_one FractionalIdeal.coeIdeal_le_one
theorem le_one_iff_exists_coeIdeal {J : FractionalIdeal S P} :
J β€ (1 : FractionalIdeal S P) β β I : Ideal R, βI = J := by
constructor
Β· intro hJ
refine' β¨β¨β¨β¨{ x : R | algebraMap R P x β J }, _β©, _β©, _β©, _β©
Β· intro a b ha hb
rw [mem_setOf, RingHom.map_add]
exact J.val.add_mem ha hb
Β· rw [mem_setOf, RingHom.map_zero]
exact J.val.zero_mem
Β· intro c x hx
rw [smul_eq_mul, mem_setOf, RingHom.map_mul, β Algebra.smul_def]
exact J.val.smul_mem c hx
Β· ext x
constructor
Β· rintro β¨y, hy, eq_yβ©
rwa [β eq_y]
Β· intro hx
obtain β¨y, rflβ© := (mem_one_iff S).mp (hJ hx)
exact mem_setOf.mpr β¨y, hx, rflβ©
Β· rintro β¨I, hIβ©
rw [β hI]
apply coeIdeal_le_one
#align fractional_ideal.le_one_iff_exists_coe_ideal FractionalIdeal.le_one_iff_exists_coeIdeal
@[simp]
theorem one_le {I : FractionalIdeal S P} : 1 β€ I β (1 : P) β I := by
rw [β coe_le_coe, coe_one, Submodule.one_le, mem_coe]
#align fractional_ideal.one_le FractionalIdeal.one_le
variable (S P)
/-- `coeIdealHom (S : Submonoid R) P` is `(β) : Ideal R β FractionalIdeal S P` as a ring hom -/
@[simps]
def coeIdealHom : Ideal R β+* FractionalIdeal S P where
toFun := coeIdeal
map_add' := coeIdeal_sup
map_mul' := coeIdeal_mul
map_one' := by rw [Ideal.one_eq_top, coeIdeal_top]
map_zero' := coeIdeal_bot
#align fractional_ideal.coe_ideal_hom FractionalIdeal.coeIdealHom
theorem coeIdeal_pow (I : Ideal R) (n : β) : β(I ^ n) = (I : FractionalIdeal S P) ^ n :=
(coeIdealHom S P).map_pow _ n
#align fractional_ideal.coe_ideal_pow FractionalIdeal.coeIdeal_pow
open BigOperators
theorem coeIdeal_finprod [IsLocalization S P] {Ξ± : Sort*} {f : Ξ± β Ideal R}
(hS : S β€ nonZeroDivisors R) :
((βαΆ a : Ξ±, f a : Ideal R) : FractionalIdeal S P) = βαΆ a : Ξ±, (f a : FractionalIdeal S P) :=
MonoidHom.map_finprod_of_injective (coeIdealHom S P).toMonoidHom (coeIdeal_injective' hS) f
#align fractional_ideal.coe_ideal_finprod FractionalIdeal.coeIdeal_finprod
end Order
variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P']
variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P'']
theorem _root_.IsFractional.map (g : P ββ[R] P') {I : Submodule R P} :
IsFractional S I β IsFractional S (Submodule.map g.toLinearMap I)
| β¨a, a_nonzero, hIβ© =>
β¨a, a_nonzero, fun b hb => by
obtain β¨b', b'_mem, hb'β© := Submodule.mem_map.mp hb
rw [AlgHom.toLinearMap_apply] at hb'
obtain β¨x, hxβ© := hI b' b'_mem
use x
rw [β g.commutes, hx, g.map_smul, hb']β©
#align is_fractional.map IsFractional.map
/-- `I.map g` is the pushforward of the fractional ideal `I` along the algebra morphism `g` -/
def map (g : P ββ[R] P') : FractionalIdeal S P β FractionalIdeal S P' := fun I =>
β¨Submodule.map g.toLinearMap I, I.isFractional.map gβ©
#align fractional_ideal.map FractionalIdeal.map
@[simp, norm_cast]
theorem coe_map (g : P ββ[R] P') (I : FractionalIdeal S P) :
β(map g I) = Submodule.map g.toLinearMap I :=
rfl
#align fractional_ideal.coe_map FractionalIdeal.coe_map
@[simp]
theorem mem_map {I : FractionalIdeal S P} {g : P ββ[R] P'} {y : P'} :
y β I.map g β β x, x β I β§ g x = y :=
Submodule.mem_map
#align fractional_ideal.mem_map FractionalIdeal.mem_map
variable (I J : FractionalIdeal S P) (g : P ββ[R] P')
@[simp]
theorem map_id : I.map (AlgHom.id _ _) = I :=
coeToSubmodule_injective (Submodule.map_id (I : Submodule R P))
#align fractional_ideal.map_id FractionalIdeal.map_id
@[simp]
theorem map_comp (g' : P' ββ[R] P'') : I.map (g'.comp g) = (I.map g).map g' :=
coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I)
#align fractional_ideal.map_comp FractionalIdeal.map_comp
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
ext x
simp only [mem_coeIdeal]
constructor
Β· rintro β¨_, β¨y, hy, rflβ©, rflβ©
exact β¨y, hy, (g.commutes y).symmβ©
Β· rintro β¨y, hy, rflβ©
exact β¨_, β¨y, hy, rflβ©, g.commutes yβ©
#align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal
@[simp]
theorem map_one : (1 : FractionalIdeal S P).map g = 1 :=
map_coeIdeal g β€
#align fractional_ideal.map_one FractionalIdeal.map_one
@[simp]
theorem map_zero : (0 : FractionalIdeal S P).map g = 0 :=
map_coeIdeal g 0
#align fractional_ideal.map_zero FractionalIdeal.map_zero
@[simp]
theorem map_add : (I + J).map g = I.map g + J.map g :=
coeToSubmodule_injective (Submodule.map_sup _ _ _)
#align fractional_ideal.map_add FractionalIdeal.map_add
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
simp only [mul_def]
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
#align fractional_ideal.map_mul FractionalIdeal.map_mul
@[simp]
theorem map_map_symm (g : P ββ[R] P') : (I.map (g : P ββ[R] P')).map (g.symm : P' ββ[R] P) = I := by
rw [β map_comp, g.symm_comp, map_id]
#align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ββ[R] P') :
(I.map (g.symm : P' ββ[R] P)).map (g : P ββ[R] P') = I := by
rw [β map_comp, g.comp_symm, map_id]
#align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map
theorem map_mem_map {f : P ββ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} :
f x β map f I β x β I :=
mem_map.trans β¨fun β¨_, hx', x'_eqβ© => h x'_eq βΈ hx', fun h => β¨x, h, rflβ©β©
#align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map
theorem map_injective (f : P ββ[R] P') (h : Function.Injective f) :
Function.Injective (map f : FractionalIdeal S P β FractionalIdeal S P') := fun _ _ hIJ =>
ext fun _ => (map_mem_map h).symm.trans (hIJ.symm βΈ map_mem_map h)
#align fractional_ideal.map_injective FractionalIdeal.map_injective
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ββ[R] P') : FractionalIdeal S P β+* FractionalIdeal S P' where
toFun := map g
invFun := map g.symm
map_add' I J := map_add I J _
map_mul' I J := map_mul I J _
left_inv I := by rw [β map_comp, AlgEquiv.symm_comp, map_id]
right_inv I := by rw [β map_comp, AlgEquiv.comp_symm, map_id]
#align fractional_ideal.map_equiv FractionalIdeal.mapEquiv
@[simp]
theorem coeFun_mapEquiv (g : P ββ[R] P') :
(mapEquiv g : FractionalIdeal S P β FractionalIdeal S P') = map g :=
rfl
#align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv
@[simp]
theorem mapEquiv_apply (g : P ββ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (βg) I :=
rfl
#align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply
@[simp]
theorem mapEquiv_symm (g : P ββ[R] P') :
((mapEquiv g).symm : FractionalIdeal S P' β+* _) = mapEquiv g.symm :=
rfl
#align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
RingEquiv.ext fun x => by simp
#align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl
theorem isFractional_span_iff {s : Set P} :
IsFractional S (span R s) β β a β S, β b : P, b β s β IsInteger R (a β’ b) :=
β¨fun β¨a, a_mem, hβ© => β¨a, a_mem, fun b hb => h b (subset_span hb)β©, fun β¨a, a_mem, hβ© =>
β¨a, a_mem, fun b hb =>
span_induction hb h
(by
rw [smul_zero]
exact isInteger_zero)
(fun x y hx hy => by
rw [smul_add]
exact isInteger_add hx hy)
fun s x hx => by
rw [smul_comm]
exact isInteger_smul hxβ©β©
#align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
rcases hI with β¨I, rflβ©
rcases exist_integer_multiples_of_finset S I with β¨β¨s, hs1β©, hsβ©
rw [isFractional_span_iff]
exact β¨s, hs1, hsβ©
#align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x β I * J) :
β T T' : Finset P, (T : Set P) β I β§ (T' : Set P) β J β§ x β span R (T * T' : Set P) :=
Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx)
#align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul
variable (S)
theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) :
FG ((I : FractionalIdeal S P) : Submodule R P) β I.FG :=
coeSubmodule_fg _ inj _
#align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg
variable {S}
theorem fg_unit (I : (FractionalIdeal S P)Λ£) : FG (I : Submodule R P) :=
Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I
#align fractional_ideal.fg_unit FractionalIdeal.fg_unit
theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) :=
fg_unit h.unit
#align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
(h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
rw [β coeIdeal_fg S inj I]
exact FractionalIdeal.fg_of_isUnit I h
#align ideal.fg_of_is_unit Ideal.fg_of_isUnit
variable (S P P')
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P β+* FractionalIdeal S P' :=
mapEquiv
{ ringEquivOfRingEquiv P P' (RingEquiv.refl R)
(show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with
commutes' := fun r => ringEquivOfRingEquiv_eq _ _ }
#align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
x β canonicalEquiv S P P' I β
β y β I,
IsLocalization.map P' (RingHom.id R) (fun y (hy : y β S) => show RingHom.id R y β S from hy)
(y : P) =
x := by
rw [canonicalEquiv, mapEquiv_apply, mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
RingEquiv.ext fun I =>
SetLike.ext_iff.mpr fun x => by
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
mem_map]
exact β¨fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©, fun β¨y, mem, Eqβ© => β¨y, mem, Eqβ©β©
#align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm
theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by
rw [β canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply]
#align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip
@[simp]
theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] (I : FractionalIdeal S P) :
canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by
ext
simp only [IsLocalization.map_map, RingHomInvPair.comp_eqβ, mem_canonicalEquiv_apply,
exists_prop, exists_exists_and_eq_and]
#align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv
theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P'']
[IsLocalization S P''] :
(canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' :=
RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'')
#align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv
@[simp]
theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by
ext
simp [IsLocalization.map_eq]
#align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal
@[simp]
theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by
rw [β canonicalEquiv_trans_canonicalEquiv S P P]
convert (canonicalEquiv S P P).symm_trans_self
exact (canonicalEquiv_symm S P P).symm
#align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self
end Semiring
section IsFractionRing
/-!
### `IsFractionRing` section
This section concerns fractional ideals in the field of fractions,
i.e. the type `FractionalIdeal Rβ° K` where `IsFractionRing R K`.
-/
variable {K K' : Type*} [Field K] [Field K']
variable [Algebra R K] [IsFractionRing R K] [Algebra R K'] [IsFractionRing R K']
variable {I J : FractionalIdeal Rβ° K} (h : K ββ[R] K')
/-- Nonzero fractional ideals contain a nonzero integer. -/
theorem exists_ne_zero_mem_isInteger [Nontrivial R] (hI : I β 0) :
β x, x β 0 β§ algebraMap R K x β I := by
obtain β¨y : K, y_mem, y_not_memβ© :=
SetLike.exists_of_lt (by simpa only using bot_lt_iff_ne_bot.mpr hI)
have y_ne_zero : y β 0 := by simpa using y_not_mem
obtain β¨z, β¨x, hxβ©β© := exists_integer_multiple Rβ° y
refine' β¨x, _, _β©
Β· rw [Ne.def, β @IsFractionRing.to_map_eq_zero_iff R _ K, hx, Algebra.smul_def]
exact mul_ne_zero (IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors z.2) y_ne_zero
Β· rw [hx]
exact smul_mem _ _ y_mem
#align fractional_ideal.exists_ne_zero_mem_is_integer FractionalIdeal.exists_ne_zero_mem_isInteger
theorem map_ne_zero [Nontrivial R] (hI : I β 0) : I.map h β 0 := by
obtain β¨x, x_ne_zero, hxβ© := exists_ne_zero_mem_isInteger hI
contrapose! x_ne_zero with map_eq_zero
refine' IsFractionRing.to_map_eq_zero_iff.mp (eq_zero_iff.mp map_eq_zero _ (mem_map.mpr _))
exact β¨algebraMap R K x, hx, h.commutes xβ©
#align fractional_ideal.map_ne_zero FractionalIdeal.map_ne_zero
@[simp]
theorem map_eq_zero_iff [Nontrivial R] : I.map h = 0 β I = 0 :=
β¨not_imp_not.mp (map_ne_zero _), fun hI => hI.symm βΈ map_zero hβ©
#align fractional_ideal.map_eq_zero_iff FractionalIdeal.map_eq_zero_iff
theorem coeIdeal_injective : Function.Injective (fun (I : Ideal R) β¦ (I : FractionalIdeal Rβ° K)) :=
coeIdeal_injective' le_rfl
#align fractional_ideal.coe_ideal_injective FractionalIdeal.coeIdeal_injective
theorem coeIdeal_inj {I J : Ideal R} :
(I : FractionalIdeal Rβ° K) = (J : FractionalIdeal Rβ° K) β I = J :=
coeIdeal_inj' le_rfl
#align fractional_ideal.coe_ideal_inj FractionalIdeal.coeIdeal_inj
@[simp]
theorem coeIdeal_eq_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 0 β I = β₯ :=
coeIdeal_eq_zero' le_rfl
#align fractional_ideal.coe_ideal_eq_zero FractionalIdeal.coeIdeal_eq_zero
theorem coeIdeal_ne_zero {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 0 β I β β₯ :=
coeIdeal_ne_zero' le_rfl
#align fractional_ideal.coe_ideal_ne_zero FractionalIdeal.coeIdeal_ne_zero
@[simp]
theorem coeIdeal_eq_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) = 1 β I = 1 := by
simpa only [Ideal.one_eq_top] using coeIdeal_inj
#align fractional_ideal.coe_ideal_eq_one FractionalIdeal.coeIdeal_eq_one
theorem coeIdeal_ne_one {I : Ideal R} : (I : FractionalIdeal Rβ° K) β 1 β I β 1 :=
not_iff_not.mpr coeIdeal_eq_one
#align fractional_ideal.coe_ideal_ne_one FractionalIdeal.coeIdeal_ne_one
end IsFractionRing
section Quotient
/-!
### `quotient` section
This section defines the ideal quotient of fractional ideals.
In this section we need that each non-zero `y : R` has an inverse in
the localization, i.e. that the localization is a field. We satisfy this
assumption by taking `S = nonZeroDivisors R`, `R`'s localization at which
is a field because `R` is a domain.
-/
open Classical
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [frac : IsFractionRing Rβ K]
instance : Nontrivial (FractionalIdeal Rββ° K) :=
β¨β¨0, 1, fun h =>
have this : (1 : K) β (0 : FractionalIdeal Rββ° K) := by
rw [β (algebraMap Rβ K).map_one]
simpa only [h] using coe_mem_one Rββ° 1
one_ne_zero ((mem_zero_iff _).mp this)β©β©
theorem ne_zero_of_mul_eq_one (I J : FractionalIdeal Rββ° K) (h : I * J = 1) : I β 0 := fun hI =>
zero_ne_one' (FractionalIdeal Rββ° K)
(by
convert h
simp [hI])
#align fractional_ideal.ne_zero_of_mul_eq_one FractionalIdeal.ne_zero_of_mul_eq_one
variable [IsDomain Rβ]
theorem _root_.IsFractional.div_of_nonzero {I J : Submodule Rβ K} :
IsFractional Rββ° I β IsFractional Rββ° J β J β 0 β IsFractional Rββ° (I / J)
| β¨aI, haI, hIβ©, β¨aJ, haJ, hJβ©, h => by
obtain β¨y, mem_J, not_mem_zeroβ© :=
SetLike.exists_of_lt (show 0 < J by simpa only using bot_lt_iff_ne_bot.mpr h)
obtain β¨y', hy'β© := hJ y mem_J
use aI * y'
constructor
Β· apply (nonZeroDivisors Rβ).mul_mem haI (mem_nonZeroDivisors_iff_ne_zero.mpr _)
intro y'_eq_zero
have : algebraMap Rβ K aJ * y = 0 := by
rw [β Algebra.smul_def, β hy', y'_eq_zero, RingHom.map_zero]
have y_zero :=
(mul_eq_zero.mp this).resolve_left
(mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).1 (IsFractionRing.injective _ _) _)
(mem_nonZeroDivisors_iff_ne_zero.mp haJ))
apply not_mem_zero
simpa
intro b hb
convert hI _ (hb _ (Submodule.smul_mem _ aJ mem_J)) using 1
rw [β hy', mul_comm b, β Algebra.smul_def, mul_smul]
#align is_fractional.div_of_nonzero IsFractional.div_of_nonzero
theorem fractional_div_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
IsFractional Rββ° (I / J : Submodule Rβ K) :=
I.isFractional.div_of_nonzero J.isFractional fun H =>
h <| coeToSubmodule_injective <| H.trans coe_zero.symm
#align fractional_ideal.fractional_div_of_nonzero FractionalIdeal.fractional_div_of_nonzero
noncomputable instance : Div (FractionalIdeal Rββ° K) :=
β¨fun I J => if h : J = 0 then 0 else β¨I / J, fractional_div_of_nonzero hβ©β©
variable {I J : FractionalIdeal Rββ° K}
@[simp]
theorem div_zero {I : FractionalIdeal Rββ° K} : I / 0 = 0 :=
dif_pos rfl
#align fractional_ideal.div_zero FractionalIdeal.div_zero
theorem div_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) :
I / J = β¨I / J, fractional_div_of_nonzero hβ© :=
dif_neg h
#align fractional_ideal.div_nonzero FractionalIdeal.div_nonzero
@[simp]
theorem coe_div {I J : FractionalIdeal Rββ° K} (hJ : J β 0) :
(β(I / J) : Submodule Rβ K) = βI / (βJ : Submodule Rβ K) :=
congr_arg _ (dif_neg hJ)
#align fractional_ideal.coe_div FractionalIdeal.coe_div
theorem mem_div_iff_of_nonzero {I J : FractionalIdeal Rββ° K} (h : J β 0) {x} :
x β I / J β β y β J, x * y β I := by
rw [div_nonzero h]
exact Submodule.mem_div_iff_forall_mul_mem
#align fractional_ideal.mem_div_iff_of_nonzero FractionalIdeal.mem_div_iff_of_nonzero
theorem mul_one_div_le_one {I : FractionalIdeal Rββ° K} : I * (1 / I) β€ 1 := by
by_cases hI : I = 0
Β· rw [hI, div_zero, mul_zero]
exact zero_le 1
Β· rw [β coe_le_coe, coe_mul, coe_div hI, coe_one]
apply Submodule.mul_one_div_le_one
#align fractional_ideal.mul_one_div_le_one FractionalIdeal.mul_one_div_le_one
theorem le_self_mul_one_div {I : FractionalIdeal Rββ° K} (hI : I β€ (1 : FractionalIdeal Rββ° K)) :
I β€ I * (1 / I) := by
by_cases hI_nz : I = 0
Β· rw [hI_nz, div_zero, mul_zero]
Β· rw [β coe_le_coe, coe_mul, coe_div hI_nz, coe_one]
rw [β coe_le_coe, coe_one] at hI
exact Submodule.le_self_mul_one_div hI
#align fractional_ideal.le_self_mul_one_div FractionalIdeal.le_self_mul_one_div
theorem le_div_iff_of_nonzero {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β β x β I, β y β J', x * y β J :=
β¨fun h _ hx => (mem_div_iff_of_nonzero hJ').mp (h hx), fun h x hx =>
(mem_div_iff_of_nonzero hJ').mpr (h x hx)β©
#align fractional_ideal.le_div_iff_of_nonzero FractionalIdeal.le_div_iff_of_nonzero
theorem le_div_iff_mul_le {I J J' : FractionalIdeal Rββ° K} (hJ' : J' β 0) :
I β€ J / J' β I * J' β€ J := by
rw [div_nonzero hJ']
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [β coe_le_coe (I := I * J') (J := J), coe_mul]
exact Submodule.le_div_iff_mul_le
#align fractional_ideal.le_div_iff_mul_le FractionalIdeal.le_div_iff_mul_le
@[simp]
theorem div_one {I : FractionalIdeal Rββ° K} : I / 1 = I := by
rw [div_nonzero (one_ne_zero' (FractionalIdeal Rββ° K))]
ext
constructor <;> intro h
Β· simpa using mem_div_iff_forall_mul_mem.mp h 1 ((algebraMap Rβ K).map_one βΈ coe_mem_one Rββ° 1)
Β· apply mem_div_iff_forall_mul_mem.mpr
rintro y β¨y', _, rflβ©
-- Porting note: this used to be { convert; rw }, flipped the order.
rw [mul_comm, Algebra.linearMap_apply, β Algebra.smul_def]
exact Submodule.smul_mem _ y' h
#align fractional_ideal.div_one FractionalIdeal.div_one
theorem eq_one_div_of_mul_eq_one_right (I J : FractionalIdeal Rββ° K) (h : I * J = 1) :
J = 1 / I := by
have hI : I β 0 := ne_zero_of_mul_eq_one I J h
suffices h' : I * (1 / I) = 1
Β· exact
congr_arg Units.inv <|
@Units.ext _ _ (Units.mkOfMulEqOne _ _ h) (Units.mkOfMulEqOne _ _ h') rfl
apply le_antisymm
Β· apply mul_le.mpr _
intro x hx y hy
rw [mul_comm]
exact (mem_div_iff_of_nonzero hI).mp hy x hx
rw [β h]
apply mul_left_mono I
apply (le_div_iff_of_nonzero hI).mpr _
intro y hy x hx
rw [mul_comm]
exact mul_mem_mul hx hy
#align fractional_ideal.eq_one_div_of_mul_eq_one_right FractionalIdeal.eq_one_div_of_mul_eq_one_right
theorem mul_div_self_cancel_iff {I : FractionalIdeal Rββ° K} : I * (1 / I) = 1 β β J, I * J = 1 :=
β¨fun h => β¨1 / I, hβ©, fun β¨J, hJβ© => by rwa [β eq_one_div_of_mul_eq_one_right I J hJ]β©
#align fractional_ideal.mul_div_self_cancel_iff FractionalIdeal.mul_div_self_cancel_iff
variable {K' : Type*} [Field K'] [Algebra Rβ K'] [IsFractionRing Rβ K']
@[simp]
theorem map_div (I J : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(I / J).map (h : K ββ[Rβ] K') = I.map h / J.map h := by
by_cases H : J = 0
Β· rw [H, div_zero, map_zero, div_zero]
Β· -- Porting note: `simp` wouldn't apply these lemmas so do them manually using `rw`
rw [β coeToSubmodule_inj, div_nonzero H, div_nonzero (map_ne_zero _ H)]
simp [Submodule.map_div]
#align fractional_ideal.map_div FractionalIdeal.map_div
-- Porting note: doesn't need to be @[simp] because this follows from `map_one` and `map_div`
theorem map_one_div (I : FractionalIdeal Rββ° K) (h : K ββ[Rβ] K') :
(1 / I).map (h : K ββ[Rβ] K') = 1 / I.map h := by rw [map_div, map_one]
#align fractional_ideal.map_one_div FractionalIdeal.map_one_div
end Quotient
section Field
variable {Rβ K L : Type*} [CommRing Rβ] [Field K] [Field L]
variable [Algebra Rβ K] [IsFractionRing Rβ K] [Algebra K L] [IsFractionRing K L]
theorem eq_zero_or_one (I : FractionalIdeal Kβ° L) : I = 0 β¨ I = 1 := by
rw [or_iff_not_imp_left]
intro hI
simp_rw [@SetLike.ext_iff _ _ _ I 1, mem_one_iff]
intro x
constructor
Β· intro x_mem
obtain β¨n, d, rflβ© := IsLocalization.mk'_surjective Kβ° x
refine' β¨n / d, _β©
rw [map_divβ, IsFractionRing.mk'_eq_div]
Β· rintro β¨x, rflβ©
obtain β¨y, y_ne, y_memβ© := exists_ne_zero_mem_isInteger hI
rw [β div_mul_cancel x y_ne, RingHom.map_mul, β Algebra.smul_def]
exact smul_mem (M := L) I (x / y) y_mem
#align fractional_ideal.eq_zero_or_one FractionalIdeal.eq_zero_or_one
theorem eq_zero_or_one_of_isField (hF : IsField Rβ) (I : FractionalIdeal Rββ° K) : I = 0 β¨ I = 1 :=
letI : Field Rβ := hF.toField
eq_zero_or_one I
#align fractional_ideal.eq_zero_or_one_of_is_field FractionalIdeal.eq_zero_or_one_of_isField
end Field
section PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ] {K : Type*} [Field K]
variable [Algebra Rβ K] [IsFractionRing Rβ K]
open Classical
variable (Rβ)
/-- `FractionalIdeal.span_finset Rβ s f` is the fractional ideal of `Rβ` generated by `f '' s`. -/
-- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a
-- `FractionalIdeal.coeToSubmodule` coercion
def spanFinset {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) : FractionalIdeal Rββ° K :=
β¨Submodule.span Rβ (f '' s), by
obtain β¨a', ha'β© := IsLocalization.exist_integer_multiples Rββ° s f
refine' β¨a', a'.2, fun x hx => Submodule.span_induction hx _ _ _ _β©
Β· rintro _ β¨i, hi, rflβ©
exact ha' i hi
Β· rw [smul_zero]
exact IsLocalization.isInteger_zero
Β· intro x y hx hy
rw [smul_add]
exact IsLocalization.isInteger_add hx hy
Β· intro c x hx
rw [smul_comm]
exact IsLocalization.isInteger_smul hxβ©
#align fractional_ideal.span_finset FractionalIdeal.spanFinset
@[simp] lemma spanFinset_coe {ΞΉ : Type*} (s : Finset ΞΉ) (f : ΞΉ β K) :
(spanFinset Rβ s f : Submodule Rβ K) = Submodule.span Rβ (f '' s) :=
rfl
variable {Rβ}
@[simp]
theorem spanFinset_eq_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f = 0 β β j β s, f j = 0 := by
simp only [β coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot,
Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iffβ]
#align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero
theorem spanFinset_ne_zero {ΞΉ : Type*} {s : Finset ΞΉ} {f : ΞΉ β K} :
spanFinset Rβ s f β 0 β β j β s, f j β 0 := by simp
#align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero
open Submodule.IsPrincipal
theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) :=
let β¨a, haβ© := exists_integer_multiple S x
isFractional_span_iff.mpr β¨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm βΈ haβ©
#align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton
variable (S)
/-- `spanSingleton x` is the fractional ideal generated by `x` if `0 β S` -/
irreducible_def spanSingleton (x : P) : FractionalIdeal S P :=
β¨span R {x}, isFractional_span_singleton xβ©
#align fractional_ideal.span_singleton FractionalIdeal.spanSingleton
-- local attribute [semireducible] span_singleton
@[simp]
theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by
rw [spanSingleton]
rfl
#align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton
@[simp]
theorem mem_spanSingleton {x y : P} : x β spanSingleton S y β β z : R, z β’ y = x := by
rw [spanSingleton]
exact Submodule.mem_span_singleton
#align fractional_ideal.mem_span_singleton FractionalIdeal.mem_spanSingleton
theorem mem_spanSingleton_self (x : P) : x β spanSingleton S x :=
(mem_spanSingleton S).mpr β¨1, one_smul _ _β©
#align fractional_ideal.mem_span_singleton_self FractionalIdeal.mem_spanSingleton_self
variable {S}
@[simp]
theorem spanSingleton_le_iff_mem {x : P} {I : FractionalIdeal S P} :
spanSingleton S x β€ I β x β I := by
rw [β coe_le_coe, coe_spanSingleton, Submodule.span_singleton_le_iff_mem, mem_coe]
#align fractional_ideal.span_singleton_le_iff_mem FractionalIdeal.spanSingleton_le_iff_mem
theorem spanSingleton_eq_spanSingleton [NoZeroSMulDivisors R P] {x y : P} :
spanSingleton S x = spanSingleton S y β β z : RΛ£, z β’ x = y := by
rw [β Submodule.span_singleton_eq_span_singleton, spanSingleton, spanSingleton]
exact Subtype.mk_eq_mk
#align fractional_ideal.span_singleton_eq_span_singleton FractionalIdeal.spanSingleton_eq_spanSingleton
theorem eq_spanSingleton_of_principal (I : FractionalIdeal S P) [IsPrincipal (I : Submodule R P)] :
I = spanSingleton S (generator (I : Submodule R P)) := by
-- Porting note: this used to be `coeToSubmodule_injective (span_singleton_generator βI).symm`
-- but Lean 4 struggled to unify everything. Turned it into an explicit `rw`.
rw [spanSingleton, β coeToSubmodule_inj, coe_mk, span_singleton_generator]
#align fractional_ideal.eq_span_singleton_of_principal FractionalIdeal.eq_spanSingleton_of_principal
theorem isPrincipal_iff (I : FractionalIdeal S P) :
IsPrincipal (I : Submodule R P) β β x, I = spanSingleton S x :=
β¨fun h => β¨@generator _ _ _ _ _ (βI) h, @eq_spanSingleton_of_principal _ _ _ _ _ _ _ I hβ©,
fun β¨x, hxβ© => { principal' := β¨x, Eq.trans (congr_arg _ hx) (coe_spanSingleton _ x)β© }β©
#align fractional_ideal.is_principal_iff FractionalIdeal.isPrincipal_iff
@[simp]
theorem spanSingleton_zero : spanSingleton S (0 : P) = 0 := by
ext
simp [Submodule.mem_span_singleton, eq_comm]
#align fractional_ideal.span_singleton_zero FractionalIdeal.spanSingleton_zero
theorem spanSingleton_eq_zero_iff {y : P} : spanSingleton S y = 0 β y = 0 :=
β¨fun h =>
span_eq_bot.mp (by simpa using congr_arg Subtype.val h : span R {y} = β₯) y (mem_singleton y),
fun h => by simp [h]β©
#align fractional_ideal.span_singleton_eq_zero_iff FractionalIdeal.spanSingleton_eq_zero_iff
theorem spanSingleton_ne_zero_iff {y : P} : spanSingleton S y β 0 β y β 0 :=
not_congr spanSingleton_eq_zero_iff
#align fractional_ideal.span_singleton_ne_zero_iff FractionalIdeal.spanSingleton_ne_zero_iff
@[simp]
theorem spanSingleton_one : spanSingleton S (1 : P) = 1 := by
ext
refine' (mem_spanSingleton S).trans ((exists_congr _).trans (mem_one_iff S).symm)
intro x'
rw [Algebra.smul_def, mul_one]
#align fractional_ideal.span_singleton_one FractionalIdeal.spanSingleton_one
@[simp]
theorem spanSingleton_mul_spanSingleton (x y : P) :
spanSingleton S x * spanSingleton S y = spanSingleton S (x * y) := by
apply coeToSubmodule_injective
simp only [coe_mul, coe_spanSingleton, span_mul_span, singleton_mul_singleton]
#align fractional_ideal.span_singleton_mul_span_singleton FractionalIdeal.spanSingleton_mul_spanSingleton
@[simp]
theorem spanSingleton_pow (x : P) (n : β) : spanSingleton S x ^ n = spanSingleton S (x ^ n) := by
induction' n with n hn
Β· rw [pow_zero, pow_zero, spanSingleton_one]
Β· rw [pow_succ, hn, spanSingleton_mul_spanSingleton, pow_succ]
#align fractional_ideal.span_singleton_pow FractionalIdeal.spanSingleton_pow
@[simp]
theorem coeIdeal_span_singleton (x : R) :
(β(Ideal.span {x} : Ideal R) : FractionalIdeal S P) = spanSingleton S (algebraMap R P x) := by
ext y
refine' (mem_coeIdeal S).trans (Iff.trans _ (mem_spanSingleton S).symm)
constructor
Β· rintro β¨y', hy', rflβ©
obtain β¨x', rflβ© := Submodule.mem_span_singleton.mp hy'
use x'
rw [smul_eq_mul, RingHom.map_mul, Algebra.smul_def]
Β· rintro β¨y', rflβ©
refine' β¨y' * x, Submodule.mem_span_singleton.mpr β¨y', rflβ©, _β©
rw [RingHom.map_mul, Algebra.smul_def]
#align fractional_ideal.coe_ideal_span_singleton FractionalIdeal.coeIdeal_span_singleton
@[simp]
theorem canonicalEquiv_spanSingleton {P'} [CommRing P'] [Algebra R P'] [IsLocalization S P']
(x : P) :
canonicalEquiv S P P' (spanSingleton S x) =
spanSingleton S
(IsLocalization.map P' (RingHom.id R)
(fun y (hy : y β S) => show RingHom.id R y β S from hy) x) := by
apply SetLike.ext_iff.mpr
intro y
constructor <;> intro h
Β· rw [mem_spanSingleton]
obtain β¨x', hx', rflβ© := (mem_canonicalEquiv_apply _ _ _).mp h
obtain β¨z, rflβ© := (mem_spanSingleton _).mp hx'
use z
rw [IsLocalization.map_smul, RingHom.id_apply]
Β· rw [mem_canonicalEquiv_apply]
obtain β¨z, rflβ© := (mem_spanSingleton _).mp h
use z β’ x
use (mem_spanSingleton _).mpr β¨z, rflβ©
simp [IsLocalization.map_smul]
#align fractional_ideal.canonical_equiv_span_singleton FractionalIdeal.canonicalEquiv_spanSingleton
theorem mem_singleton_mul {x y : P} {I : FractionalIdeal S P} :
y β spanSingleton S x * I β β y' β I, y = x * y' := by
constructor
Β· intro h
refine FractionalIdeal.mul_induction_on h ?_ ?_
Β· intro x' hx' y' hy'
obtain β¨a, haβ© := (mem_spanSingleton S).mp hx'
use a β’ y', Submodule.smul_mem (I : Submodule R P) a hy'
rw [β ha, Algebra.mul_smul_comm, Algebra.smul_mul_assoc]
Β· rintro _ _ β¨y, hy, rflβ© β¨y', hy', rflβ©
exact β¨y + y', Submodule.add_mem (I : Submodule R P) hy hy', (mul_add _ _ _).symmβ©
Β· rintro β¨y', hy', rflβ©
exact mul_mem_mul ((mem_spanSingleton S).mpr β¨1, one_smul _ _β©) hy'
#align fractional_ideal.mem_singleton_mul FractionalIdeal.mem_singleton_mul
variable (K)
theorem mk'_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {x y : Rβ} (hy : y β Rββ°) :
spanSingleton Rββ° (IsLocalization.mk' K x β¨y, hyβ©) * I = (J : FractionalIdeal Rββ° K) β
Ideal.span {x} * I = Ideal.span {y} * J := by
have :
spanSingleton Rββ° (IsLocalization.mk' _ (1 : Rβ) β¨y, hyβ©) *
spanSingleton Rββ° (algebraMap Rβ K y) =
1 := by
rw [spanSingleton_mul_spanSingleton, mul_comm, β IsLocalization.mk'_eq_mul_mk'_one,
IsLocalization.mk'_self, spanSingleton_one]
let y' : (FractionalIdeal Rββ° K)Λ£ := Units.mkOfMulEqOne _ _ this
have coe_y' : βy' = spanSingleton Rββ° (IsLocalization.mk' K (1 : Rβ) β¨y, hyβ©) := rfl
refine' Iff.trans _ (y'.mul_right_inj.trans coeIdeal_inj)
rw [coe_y', coeIdeal_mul, coeIdeal_span_singleton, coeIdeal_mul, coeIdeal_span_singleton, β
mul_assoc, spanSingleton_mul_spanSingleton, β mul_assoc, spanSingleton_mul_spanSingleton,
mul_comm (mk' _ _ _), β IsLocalization.mk'_eq_mul_mk'_one, mul_comm (mk' _ _ _), β
IsLocalization.mk'_eq_mul_mk'_one, IsLocalization.mk'_self, spanSingleton_one, one_mul]
#align fractional_ideal.mk'_mul_coe_ideal_eq_coe_ideal FractionalIdeal.mk'_mul_coeIdeal_eq_coeIdeal
variable {K}
theorem spanSingleton_mul_coeIdeal_eq_coeIdeal {I J : Ideal Rβ} {z : K} :
spanSingleton Rββ° z * (I : FractionalIdeal Rββ° K) = J β
Ideal.span {((IsLocalization.sec Rββ° z).1 : Rβ)} * I =
Ideal.span {((IsLocalization.sec Rββ° z).2 : Rβ)} * J := by
rw [β mk'_mul_coeIdeal_eq_coeIdeal K (IsLocalization.sec Rββ° z).2.prop,
IsLocalization.mk'_sec K z]
#align fractional_ideal.span_singleton_mul_coe_ideal_eq_coe_ideal FractionalIdeal.spanSingleton_mul_coeIdeal_eq_coeIdeal
variable [IsDomain Rβ]
theorem one_div_spanSingleton (x : K) : 1 / spanSingleton Rββ° x = spanSingleton Rββ° xβ»ΒΉ :=
if h : x = 0 then by simp [h] else (eq_one_div_of_mul_eq_one_right _ _ (by simp [h])).symm
#align fractional_ideal.one_div_span_singleton FractionalIdeal.one_div_spanSingleton
@[simp]
theorem div_spanSingleton (J : FractionalIdeal Rββ° K) (d : K) :
J / spanSingleton Rββ° d = spanSingleton Rββ° dβ»ΒΉ * J := by
rw [β one_div_spanSingleton]
by_cases hd : d = 0
Β· simp only [hd, spanSingleton_zero, div_zero, zero_mul]
have h_spand : spanSingleton Rββ° d β 0 := mt spanSingleton_eq_zero_iff.mp hd
apply le_antisymm
Β· intro x hx
dsimp only [val_eq_coe] at hx β’ -- Porting note: get rid of the partially applied `coe`s
rw [coe_div h_spand, Submodule.mem_div_iff_forall_mul_mem] at hx
specialize hx d (mem_spanSingleton_self Rββ° d)
have h_xd : x = dβ»ΒΉ * (x * d) := by field_simp
rw [coe_mul, one_div_spanSingleton, h_xd]
exact Submodule.mul_mem_mul (mem_spanSingleton_self Rββ° _) hx
Β· rw [le_div_iff_mul_le h_spand, mul_assoc, mul_left_comm, one_div_spanSingleton,
spanSingleton_mul_spanSingleton, inv_mul_cancel hd, spanSingleton_one, mul_one]
#align fractional_ideal.div_span_singleton FractionalIdeal.div_spanSingleton
theorem exists_eq_spanSingleton_mul (I : FractionalIdeal Rββ° K) :
β (a : Rβ) (aI : Ideal Rβ), a β 0 β§ I = spanSingleton Rββ° (algebraMap Rβ K a)β»ΒΉ * aI := by
obtain β¨a_inv, nonzero, haβ© := I.isFractional
have nonzero := mem_nonZeroDivisors_iff_ne_zero.mp nonzero
have map_a_nonzero : algebraMap Rβ K a_inv β 0 :=
mt IsFractionRing.to_map_eq_zero_iff.mp nonzero
refine'
β¨a_inv,
Submodule.comap (Algebra.linearMap Rβ K) β(spanSingleton Rββ° (algebraMap Rβ K a_inv) * I),
nonzero, ext fun x => Iff.trans β¨_, _β© mem_singleton_mul.symmβ©
Β· intro hx
obtain β¨x', hx'β© := ha x hx
rw [Algebra.smul_def] at hx'
refine' β¨algebraMap Rβ K x', (mem_coeIdeal _).mpr β¨x', mem_singleton_mul.mpr _, rflβ©, _β©
Β· exact β¨x, hx, hx'β©
Β· rw [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
Β· rintro β¨y, hy, rflβ©
obtain β¨x', hx', rflβ© := (mem_coeIdeal _).mp hy
obtain β¨y', hy', hx'β© := mem_singleton_mul.mp hx'
rw [Algebra.linearMap_apply] at hx'
rwa [hx', β mul_assoc, inv_mul_cancel map_a_nonzero, one_mul]
#align fractional_ideal.exists_eq_span_singleton_mul FractionalIdeal.exists_eq_spanSingleton_mul
instance isPrincipal {R} [CommRing R] [IsDomain R] [IsPrincipalIdealRing R] [Algebra R K]
[IsFractionRing R K] (I : FractionalIdeal Rβ° K) : (I : Submodule R K).IsPrincipal := by
obtain β¨a, aI, -, haβ© := exists_eq_spanSingleton_mul I
use (algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)
suffices I = spanSingleton Rβ° ((algebraMap R K a)β»ΒΉ * algebraMap R K (generator aI)) by
rw [spanSingleton] at this
exact congr_arg Subtype.val this
conv_lhs => rw [ha, β span_singleton_generator aI]
rw [Ideal.submodule_span_eq, coeIdeal_span_singleton (generator aI),
spanSingleton_mul_spanSingleton]
#align fractional_ideal.is_principal FractionalIdeal.isPrincipal
theorem le_spanSingleton_mul_iff {x : P} {I J : FractionalIdeal S P} :
I β€ spanSingleton S x * J β β zI β I, β zJ β J, x * zJ = zI :=
show (β {zI} (hzI : zI β I), zI β spanSingleton _ x * J) β β zI β I, β zJ β J, x * zJ = zI by
simp only [mem_singleton_mul, eq_comm]
#align fractional_ideal.le_span_singleton_mul_iff FractionalIdeal.le_spanSingleton_mul_iff
theorem spanSingleton_mul_le_iff {x : P} {I J : FractionalIdeal S P} :
spanSingleton _ x * I β€ J β β z β I, x * z β J := by
simp only [mul_le, mem_singleton_mul, mem_spanSingleton]
constructor
Β· intro h zI hzI
exact h x β¨1, one_smul _ _β© zI hzI
Β· rintro h _ β¨z, rflβ© zI hzI
rw [Algebra.smul_mul_assoc]
exact Submodule.smul_mem J.1 _ (h zI hzI)
#align fractional_ideal.span_singleton_mul_le_iff FractionalIdeal.spanSingleton_mul_le_iff
theorem eq_spanSingleton_mul {x : P} {I J : FractionalIdeal S P} :
I = spanSingleton _ x * J β (β zI β I, β zJ β J, x * zJ = zI) β§ β z β J, x * z β I := by
simp only [le_antisymm_iff, le_spanSingleton_mul_iff, spanSingleton_mul_le_iff]
#align fractional_ideal.eq_span_singleton_mul FractionalIdeal.eq_spanSingleton_mul
end PrincipalIdealRing
variable {Rβ : Type*} [CommRing Rβ]
variable {K : Type*} [Field K] [Algebra Rβ K] [frac : IsFractionRing Rβ K]
attribute [local instance] Classical.propDecidable
theorem isNoetherian_zero : IsNoetherian Rβ (0 : FractionalIdeal Rββ° K) :=
isNoetherian_submodule.mpr fun I (hI : I β€ (0 : FractionalIdeal Rββ° K)) => by
rw [coe_zero, le_bot_iff] at hI
rw [hI]
exact fg_bot
#align fractional_ideal.is_noetherian_zero FractionalIdeal.isNoetherian_zero
theorem isNoetherian_iff {I : FractionalIdeal Rββ° K} :
IsNoetherian Rβ I β β J β€ I, (J : Submodule Rβ K).FG :=
isNoetherian_submodule.trans β¨fun h _ hJ => h _ hJ, fun h J hJ => h β¨J, isFractional_of_le hJβ© hJβ©
#align fractional_ideal.is_noetherian_iff FractionalIdeal.isNoetherian_iff
theorem isNoetherian_coeIdeal [IsNoetherianRing Rβ] (I : Ideal Rβ) :
IsNoetherian Rβ (I : FractionalIdeal Rββ° K) := by
rw [isNoetherian_iff]
intro J hJ
obtain β¨J, rflβ© := le_one_iff_exists_coeIdeal.mp (le_trans hJ coeIdeal_le_one)
exact (IsNoetherian.noetherian J).map _
#align fractional_ideal.is_noetherian_coe_ideal FractionalIdeal.isNoetherian_coeIdeal
variable [IsDomain Rβ]
theorem isNoetherian_spanSingleton_inv_to_map_mul (x : Rβ) {I : FractionalIdeal Rββ° K}
(hI : IsNoetherian Rβ I) :
IsNoetherian Rβ (spanSingleton Rββ° (algebraMap Rβ K x)β»ΒΉ * I : FractionalIdeal Rββ° K) := by
by_cases hx : x = 0
Β· rw [hx, RingHom.map_zero, inv_zero, spanSingleton_zero, zero_mul]
exact isNoetherian_zero
have h_gx : algebraMap Rβ K x β 0 :=
mt ((injective_iff_map_eq_zero (algebraMap Rβ K)).mp (IsFractionRing.injective _ _) x) hx
have h_spanx : spanSingleton Rββ° (algebraMap Rβ K x) β 0 := spanSingleton_ne_zero_iff.mpr h_gx
rw [isNoetherian_iff] at hI β’
intro J hJ
rw [β div_spanSingleton, le_div_iff_mul_le h_spanx] at hJ
obtain β¨s, hsβ© := hI _ hJ
use s * {(algebraMap Rβ K x)β»ΒΉ}
rw [Finset.coe_mul, Finset.coe_singleton, β span_mul_span, hs, β coe_spanSingleton Rββ°, β
coe_mul, mul_assoc, spanSingleton_mul_spanSingleton, mul_inv_cancel h_gx, spanSingleton_one,
mul_one]
#align fractional_ideal.is_noetherian_span_singleton_inv_to_map_mul FractionalIdeal.isNoetherian_spanSingleton_inv_to_map_mul
/-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
obtain β¨d, J, _, rflβ© := exists_eq_spanSingleton_mul I
apply isNoetherian_spanSingleton_inv_to_map_mul
| apply isNoetherian_coeIdeal | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I := by
obtain β¨d, J, _, rflβ© := exists_eq_spanSingleton_mul I
apply isNoetherian_spanSingleton_inv_to_map_mul
| Mathlib.RingTheory.FractionalIdeal.1586_0.90B1BH8AtSmfl9S | /-- Every fractional ideal of a noetherian integral domain is noetherian. -/
theorem isNoetherian [IsNoetherianRing Rβ] (I : FractionalIdeal Rββ° K) : IsNoetherian Rβ I | Mathlib_RingTheory_FractionalIdeal |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
β’ (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
| have hxz := hxy.trans hyz | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
hxz : x < z
β’ (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
| rw [β sub_pos] at hxy hxz hyz | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
β’ (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
| suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
this : f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y)
β’ (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
| ring_nf at this β’ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
this : f y * (y - x)β»ΒΉ + f y * (-y + z)β»ΒΉ β€ (y - x)β»ΒΉ * f x + (-y + z)β»ΒΉ * f z
β’ f y * (y - x)β»ΒΉ - (y - x)β»ΒΉ * f x β€ -(f y * (-y + z)β»ΒΉ) + (-y + z)β»ΒΉ * f z | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
| linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
| set a := (z - y) / (z - x) | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
| set b := (y - x) / (z - x) | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
| have hy : a β’ x + b β’ z = y := by field_simp; ring | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
β’ a β’ x + b β’ z = y | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by | field_simp | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
β’ (z - y) * x + (y - x) * z = y * (z - x) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; | ring | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
| have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp) | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ a | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by | apply div_nonneg | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
case ha
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ z - y | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> | linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
case hb
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ z - x | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> | linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ b | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by | apply div_nonneg | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
case ha
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ y - x | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> | linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
case hb
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ 0 β€ z - x | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> | linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
β’ a + b = 1 | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by | field_simp | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : f (a β’ x + b β’ z) β€ a β’ f x + b β’ f z
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
| rw [hy] at key | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : f y β€ a β’ f x + b β’ f z
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
| replace key := mul_le_mul_of_nonneg_left key hxz.le | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : (z - x) * f y β€ (z - x) * (a β’ f x + b β’ f z)
β’ f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
| field_simp [mul_comm (z - x) _] at key β’ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : f y * (z - x) β€ (z - y) * f x + (y - x) * f z
β’ (f y * (z - y) + f y * (y - x)) / ((y - x) * (z - y)) β€ (f x * (z - y) + f z * (y - x)) / ((y - x) * (z - y)) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
| rw [div_le_div_right] | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
| Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : f y * (z - x) β€ (z - y) * f x + (y - x) * f z
β’ f y * (z - y) + f y * (y - x) β€ f x * (z - y) + f z * (y - x) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· | linarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
hy : a β’ x + b β’ z = y
key : f y * (z - x) β€ (z - y) * f x + (y - x) * f z
β’ 0 < (y - x) * (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· | nlinarith | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· | Mathlib.Analysis.Convex.Slope.24_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConcaveOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
β’ (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
| have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz) | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
| Mathlib.Analysis.Convex.Slope.48_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConcaveOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
this : -(((-f) z - (-f) y) / (z - y)) β€ -(((-f) y - (-f) x) / (y - x))
β’ (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
| simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
| Mathlib.Analysis.Convex.Slope.48_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : ConcaveOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
this : (f z - f y) / (z - y) β€ (f y - f x) / (y - x)
β’ (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
| exact this | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
| Mathlib.Analysis.Convex.Slope.48_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
β’ (f y - f x) / (y - x) < (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
| have hxz := hxy.trans hyz | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
hxz : x < z
β’ (f y - f x) / (y - x) < (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
| have hxz' := hxz.ne | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : x < y
hyz : y < z
hxz : x < z
hxz' : x β z
β’ (f y - f x) / (y - x) < (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
| rw [β sub_pos] at hxy hxz hyz | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
β’ (f y - f x) / (y - x) < (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
| suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
this : f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y)
β’ (f y - f x) / (y - x) < (f z - f y) / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
| ring_nf at this β’ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
this : f y * (y - x)β»ΒΉ + f y * (-y + z)β»ΒΉ < (y - x)β»ΒΉ * f x + (-y + z)β»ΒΉ * f z
β’ f y * (y - x)β»ΒΉ - (y - x)β»ΒΉ * f x < -(f y * (-y + z)β»ΒΉ) + (-y + z)β»ΒΉ * f z | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
| linarith | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
β’ f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
| set a := (z - y) / (z - x) | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
a : π := (z - y) / (z - x)
β’ f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
| set b := (y - x) / (z - x) | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
π : Type u_1
instβ : LinearOrderedField π
s : Set π
f : π β π
hf : StrictConvexOn π s f
x y z : π
hx : x β s
hz : z β s
hxy : 0 < y - x
hyz : 0 < z - y
hxz : 0 < z - x
hxz' : x β z
a : π := (z - y) / (z - x)
b : π := (y - x) / (z - x)
β’ f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) | /-
Copyright (c) 2021 Yury Kudriashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudriashov, Malo JaffrΓ©
-/
import Mathlib.Analysis.Convex.Function
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
#align_import analysis.convex.slope from "leanprover-community/mathlib"@"a8b2226cfb0a79f5986492053fc49b1a0c6aeffb"
/-!
# Slopes of convex functions
This file relates convexity/concavity of functions in a linearly ordered field and the monotonicity
of their slopes.
The main use is to show convexity/concavity from monotonicity of the derivative.
-/
variable {π : Type*} [LinearOrderedField π] {s : Set π} {f : π β π}
/-- If `f : π β π` is convex, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is less than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConvexOn.slope_mono_adjacent (hf : ConvexOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f y - f x) / (y - x) β€ (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) β€ f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
have hy : a β’ x + b β’ z = y := by field_simp; ring
have key :=
hf.2 hx hz (show 0 β€ a by apply div_nonneg <;> linarith)
(show 0 β€ b by apply div_nonneg <;> linarith)
(show a + b = 1 by field_simp)
rw [hy] at key
replace key := mul_le_mul_of_nonneg_left key hxz.le
field_simp [mul_comm (z - x) _] at key β’
rw [div_le_div_right]
Β· linarith
Β· nlinarith
#align convex_on.slope_mono_adjacent ConvexOn.slope_mono_adjacent
/-- If `f : π β π` is concave, then for any three points `x < y < z` the slope of the secant line of
`f` on `[x, y]` is greater than the slope of the secant line of `f` on `[x, z]`. -/
theorem ConcaveOn.slope_anti_adjacent (hf : ConcaveOn π s f) {x y z : π} (hx : x β s) (hz : z β s)
(hxy : x < y) (hyz : y < z) : (f z - f y) / (z - y) β€ (f y - f x) / (y - x) := by
have := neg_le_neg (ConvexOn.slope_mono_adjacent hf.neg hx hz hxy hyz)
simp only [Pi.neg_apply, β neg_div, neg_sub', neg_neg] at this
exact this
#align concave_on.slope_anti_adjacent ConcaveOn.slope_anti_adjacent
/-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
| have hy : a β’ x + b β’ z = y := by field_simp; ring | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) := by
have hxz := hxy.trans hyz
have hxz' := hxz.ne
rw [β sub_pos] at hxy hxz hyz
suffices f y / (y - x) + f y / (z - y) < f x / (y - x) + f z / (z - y) by
ring_nf at this β’
linarith
set a := (z - y) / (z - x)
set b := (y - x) / (z - x)
| Mathlib.Analysis.Convex.Slope.57_0.2UqTeSfXEWgn9kZ | /-- If `f : π β π` is strictly convex, then for any three points `x < y < z` the slope of the
secant line of `f` on `[x, y]` is strictly less than the slope of the secant line of `f` on
`[x, z]`. -/
theorem StrictConvexOn.slope_strict_mono_adjacent (hf : StrictConvexOn π s f) {x y z : π}
(hx : x β s) (hz : z β s) (hxy : x < y) (hyz : y < z) :
(f y - f x) / (y - x) < (f z - f y) / (z - y) | Mathlib_Analysis_Convex_Slope |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.