fact stringlengths 6 3.84k | type stringclasses 11
values | library stringclasses 32
values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
subset_mul_set {s : Set R} {I : TwoSidedIdeal R} (h : s ⊆ I) (t : Set R) :
s * t ⊆ I := by
rintro - ⟨x, hx, r, -, rfl⟩
exact mul_mem_right _ _ _ (h hx) | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | subset_mul_set | null |
mem_span_iff_mem_addSubgroup_closure_nonunital {s : Set R} {z : R} :
z ∈ span s ↔ z ∈ AddSubgroup.closure (s ∪ s * univ ∪ univ * s ∪ univ * s * univ) := by
trans z ∈ span (s ∪ s * univ ∪ univ * s ∪ univ * s * univ)
· refine ⟨(span_mono (by simp only [Set.union_assoc, Set.subset_union_left]) ·), fun h ↦ ?_⟩
refine mem_span_iff.mp h (span s) ?_
simp only [union_subset_iff, union_assoc]
exact ⟨subset_span, subset_mul_set subset_span _, set_mul_subset subset_span _,
subset_mul_set (set_mul_subset subset_span _) _⟩
· refine mem_span_iff_mem_addSubgroup_closure_absorbing ?_ ?_
· rintro x y (((hy | ⟨y, hy, r, -, rfl⟩) | ⟨r, -, y, hy, rfl⟩) |
⟨-, ⟨r', -, y, hy, rfl⟩, r, -, rfl⟩)
· exact .inl <| .inr <| ⟨x, mem_univ _, y, hy, rfl⟩
· exact .inr <| ⟨x * y, ⟨x, mem_univ _, y, hy, rfl⟩, r, mem_univ _, mul_assoc ..⟩
· exact .inl <| .inr <| ⟨x * r, mem_univ _, y, hy, mul_assoc ..⟩
· refine .inr <| ⟨x * r' * y, ⟨x * r', mem_univ _, y, hy, ?_⟩, ⟨r, mem_univ _, ?_⟩⟩
all_goals simp [mul_assoc]
· rintro y x (((hy | ⟨y, hy, r, -, rfl⟩) | ⟨r, -, y, hy, rfl⟩) |
⟨-, ⟨r', -, y, hy, rfl⟩, r, -, rfl⟩)
· exact .inl <| .inl <| .inr ⟨y, hy, x, mem_univ _, rfl⟩
· exact .inl <| .inl <| .inr ⟨y, hy, r * x, mem_univ _, (mul_assoc ..).symm⟩
· exact .inr <| ⟨r * y, ⟨r, mem_univ _, y, hy, rfl⟩, x, mem_univ _, rfl⟩
· refine .inr <| ⟨r' * y, ⟨r', mem_univ _, y, hy, rfl⟩, r * x, mem_univ _, ?_⟩
simp [mul_assoc] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_span_iff_mem_addSubgroup_closure_nonunital | null |
mem_span_iff_mem_addSubgroup_closure {s : Set R} {z : R} :
z ∈ span s ↔ z ∈ AddSubgroup.closure (univ * s * univ) := by
trans z ∈ span (univ * s * univ)
· refine ⟨(span_mono (fun x hx ↦ ?_) ·), fun hz ↦ ?_⟩
· exact ⟨1 * x, ⟨1, mem_univ _, x, hx, rfl⟩, 1, mem_univ _, by simp⟩
· exact mem_span_iff.mp hz (span s) <| subset_mul_set (set_mul_subset subset_span _) _
· refine mem_span_iff_mem_addSubgroup_closure_absorbing ?_ ?_
· intro x y hy
rw [mul_assoc] at hy ⊢
obtain ⟨r, -, y, hy, rfl⟩ := hy
exact ⟨x * r, mem_univ _, y, hy, mul_assoc ..⟩
· rintro - x ⟨y, hy, r, -, rfl⟩
exact ⟨y, hy, r * x, mem_univ _, (mul_assoc ..).symm⟩
variable (I : TwoSidedIdeal R) | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_span_iff_mem_addSubgroup_closure | null |
leftModule : Module R I :=
Function.Injective.module _ (coeAddMonoidHom I) Subtype.coe_injective fun _ _ ↦ rfl
@[simp] | instance | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | leftModule | null |
coe_smul {r : R} {x : I} : (r • x : R) = r * (x : R) := rfl | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | coe_smul | null |
rightModule : Module Rᵐᵒᵖ I :=
Function.Injective.module _ (coeAddMonoidHom I) Subtype.coe_injective fun _ _ ↦ rfl
@[simp] | instance | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | rightModule | null |
coe_mop_smul {r : Rᵐᵒᵖ} {x : I} : (r • x : R) = (x : R) * r.unop := rfl | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | coe_mop_smul | null |
@[simps]
subtype : I →ₗ[R] R where
toFun x := x.1
map_add' _ _ := rfl
map_smul' _ _ := rfl | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | subtype | For any `I : RingCon R`, when we view it as an ideal, `I.subtype` is the injective `R`-linear map
`I → R`. |
subtype_injective : Function.Injective (subtype I) :=
Subtype.coe_injective
@[simp] | theorem | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | subtype_injective | null |
coe_subtype : ⇑(subtype I) = Subtype.val :=
rfl | theorem | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | coe_subtype | null |
@[simps]
subtypeMop : I →ₗ[Rᵐᵒᵖ] Rᵐᵒᵖ where
toFun x := MulOpposite.op x.1
map_add' _ _ := rfl
map_smul' _ _ := rfl | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | subtypeMop | For any `RingCon R`, when we view it as an ideal in `Rᵒᵖ`, `subtype` is the injective `Rᵐᵒᵖ`-linear
map `I → Rᵐᵒᵖ`. |
subtypeMop_injective : Function.Injective (subtypeMop I) :=
MulOpposite.op_injective.comp Subtype.coe_injective | theorem | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | subtypeMop_injective | null |
fromIdeal : Ideal R →o TwoSidedIdeal R where
toFun I := span I
monotone' _ _ := span_mono | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | fromIdeal | Given an ideal `I`, `span I` is the smallest two-sided ideal containing `I`. |
mem_fromIdeal {I : Ideal R} {x : R} :
x ∈ fromIdeal I ↔ x ∈ span I := by simp [fromIdeal] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_fromIdeal | null |
asIdeal : TwoSidedIdeal R →o Ideal R where
toFun I :=
{ carrier := I
add_mem' := I.add_mem
zero_mem' := I.zero_mem
smul_mem' := fun r x hx => I.mul_mem_left r x hx }
monotone' _ _ h _ h' := h h'
@[simp] | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | asIdeal | Every two-sided ideal is also a left ideal. |
mem_asIdeal {I : TwoSidedIdeal R} {x : R} :
x ∈ asIdeal I ↔ x ∈ I := by simp [asIdeal] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_asIdeal | null |
gc : GaloisConnection fromIdeal (asIdeal (R := R)) :=
fun I J => ⟨fun h x hx ↦ h <| mem_span_iff.2 fun _ H ↦ H hx, fun h x hx ↦ by
simp only [fromIdeal, OrderHom.coe_mk, mem_span_iff] at hx
exact hx _ h⟩
@[simp] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | gc | null |
coe_asIdeal {I : TwoSidedIdeal R} : (asIdeal I : Set R) = I := rfl
@[simp] lemma bot_asIdeal : (⊥ : TwoSidedIdeal R).asIdeal = ⊥ := rfl
@[simp] lemma top_asIdeal : (⊤ : TwoSidedIdeal R).asIdeal = ⊤ := rfl | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | coe_asIdeal | null |
asIdealOpposite : TwoSidedIdeal R →o Ideal Rᵐᵒᵖ where
toFun I := asIdeal ⟨I.ringCon.op⟩
monotone' I J h x h' := by
simp only [mem_asIdeal, mem_iff, RingCon.op_iff, MulOpposite.unop_zero] at h' ⊢
exact J.rel_iff _ _ |>.2 <| h <| I.rel_iff 0 x.unop |>.1 h' | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | asIdealOpposite | Every two-sided ideal is also a right ideal. |
mem_asIdealOpposite {I : TwoSidedIdeal R} {x : Rᵐᵒᵖ} :
x ∈ asIdealOpposite I ↔ x.unop ∈ I := by
simpa [asIdealOpposite, asIdeal, TwoSidedIdeal.mem_iff, RingCon.op_iff] using
⟨I.ringCon.symm, I.ringCon.symm⟩ | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_asIdealOpposite | null |
orderIsoIdeal : TwoSidedIdeal R ≃o Ideal R where
toFun := asIdeal
invFun := fromIdeal
map_rel_iff' := ⟨fun h _ hx ↦ h hx, fun h ↦ asIdeal.monotone' h⟩
left_inv _ := SetLike.ext fun _ ↦ mem_span_iff.trans <| by aesop
right_inv J := SetLike.ext fun x ↦ mem_span_iff.trans
⟨fun h ↦ mem_mk' _ _ _ _ _ _ _ |>.1 <| h (mk'
J J.zero_mem J.add_mem J.neg_mem (J.mul_mem_left _) (J.mul_mem_right _))
(fun x => by simp), by aesop⟩ | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | orderIsoIdeal | When the ring is commutative, two-sided ideals are exactly the same as left ideals. |
toTwoSided (I : Ideal R) [I.IsTwoSided] : TwoSidedIdeal R :=
TwoSidedIdeal.mk' I I.zero_mem I.add_mem I.neg_mem (I.smul_mem _) (I.mul_mem_right _)
@[simp] | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | toTwoSided | Bundle an `Ideal` that is already two-sided as a `TwoSidedIdeal`. |
mem_toTwoSided {I : Ideal R} [I.IsTwoSided] {x : R} :
x ∈ I.toTwoSided ↔ x ∈ I := by
simp [toTwoSided]
@[simp] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | mem_toTwoSided | null |
coe_toTwoSided (I : Ideal R) [I.IsTwoSided] : (I.toTwoSided : Set R) = I := by
simp [toTwoSided]
@[simp] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | coe_toTwoSided | null |
toTwoSided_asIdeal (I : TwoSidedIdeal R) : I.asIdeal.toTwoSided = I :=
by ext; simp
@[simp] | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | toTwoSided_asIdeal | null |
asIdeal_toTwoSided (I : Ideal R) [I.IsTwoSided] : I.toTwoSided.asIdeal = I := by
ext
simp | lemma | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | asIdeal_toTwoSided | null |
@[simps] TwoSidedIdeal.orderIsoIsTwoSided {R : Type*} [Ring R] :
TwoSidedIdeal R ≃o {I : Ideal R // I.IsTwoSided} where
toFun I := ⟨I.asIdeal, inferInstance⟩
invFun I := have := I.2; I.1.toTwoSided
left_inv _ := by simp
right_inv I := by simp
map_rel_iff' {I I'} := by simp [SetLike.le_def] | def | RingTheory | [
"Mathlib.Algebra.Group.Subgroup.Map",
"Mathlib.Algebra.Module.Opposite",
"Mathlib.Algebra.Module.Submodule.Lattice",
"Mathlib.RingTheory.Congruence.Opposite",
"Mathlib.RingTheory.Ideal.Defs",
"Mathlib.RingTheory.TwoSidedIdeal.Lattice",
"Mathlib.Algebra.Group.Pointwise.Set.Basic"
] | Mathlib/RingTheory/TwoSidedIdeal/Operations.lean | TwoSidedIdeal.orderIsoIsTwoSided | A two-sided ideal is simply a left ideal that is two-sided. |
of_wfDvdMonoid_associates (_ : WfDvdMonoid (Associates α)) : WfDvdMonoid α :=
⟨(mk_surjective.wellFounded_iff mk_dvdNotUnit_mk_iff.symm).2 wellFounded_dvdNotUnit⟩
variable [WfDvdMonoid α] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | of_wfDvdMonoid_associates | null |
wfDvdMonoid_associates : WfDvdMonoid (Associates α) :=
⟨(mk_surjective.wellFounded_iff mk_dvdNotUnit_mk_iff.symm).1 wellFounded_dvdNotUnit⟩ | instance | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | wfDvdMonoid_associates | null |
wellFoundedLT_associates : WellFoundedLT (Associates α) :=
⟨Subrelation.wf dvdNotUnit_of_lt wellFounded_dvdNotUnit⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | wellFoundedLT_associates | null |
WfDvdMonoid.of_wellFoundedLT_associates [CancelCommMonoidWithZero α]
(h : WellFoundedLT (Associates α)) : WfDvdMonoid α :=
WfDvdMonoid.of_wfDvdMonoid_associates
⟨by
convert h.wf
ext
exact Associates.dvdNotUnit_iff_lt⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | WfDvdMonoid.of_wellFoundedLT_associates | null |
WfDvdMonoid.iff_wellFounded_associates [CancelCommMonoidWithZero α] :
WfDvdMonoid α ↔ WellFoundedLT (Associates α) :=
⟨by apply WfDvdMonoid.wellFoundedLT_associates, WfDvdMonoid.of_wellFoundedLT_associates⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | WfDvdMonoid.iff_wellFounded_associates | null |
Associates.ufm [CancelCommMonoidWithZero α] [UniqueFactorizationMonoid α] :
UniqueFactorizationMonoid (Associates α) :=
{ (WfDvdMonoid.wfDvdMonoid_associates : WfDvdMonoid (Associates α)) with
irreducible_iff_prime := by
rw [← Associates.irreducible_iff_prime_iff]
apply UniqueFactorizationMonoid.irreducible_iff_prime } | instance | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | Associates.ufm | null |
prime_factors_unique [CancelCommMonoidWithZero α] :
∀ {f g : Multiset α},
(∀ x ∈ f, Prime x) → (∀ x ∈ g, Prime x) → f.prod ~ᵤ g.prod → Multiset.Rel Associated f g := by
classical
intro f
induction f using Multiset.induction_on with
| empty =>
intro g _ hg h
exact Multiset.rel_zero_left.2 <|
Multiset.eq_zero_of_forall_notMem fun x hx =>
have : IsUnit g.prod := by simpa [associated_one_iff_isUnit] using h.symm
(hg x hx).not_unit <|
isUnit_iff_dvd_one.2 <| (Multiset.dvd_prod hx).trans (isUnit_iff_dvd_one.1 this)
| cons p f ih =>
intro g hf hg hfg
let ⟨b, hbg, hb⟩ :=
(exists_associated_mem_of_dvd_prod (hf p (by simp)) fun q hq => hg _ hq) <|
hfg.dvd_iff_dvd_right.1 (show p ∣ (p ::ₘ f).prod by simp)
haveI := Classical.decEq α
rw [← Multiset.cons_erase hbg]
exact
Multiset.Rel.cons hb
(ih (fun q hq => hf _ (by simp [hq]))
(fun {q} (hq : q ∈ g.erase b) => hg q (Multiset.mem_of_mem_erase hq))
(Associated.of_mul_left
(by rwa [← Multiset.prod_cons, ← Multiset.prod_cons, Multiset.cons_erase hbg]) hb
(hf p (by simp)).ne_zero)) | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | prime_factors_unique | null |
factors_unique {f g : Multiset α} (hf : ∀ x ∈ f, Irreducible x)
(hg : ∀ x ∈ g, Irreducible x) (h : f.prod ~ᵤ g.prod) : Multiset.Rel Associated f g :=
prime_factors_unique (fun x hx => UniqueFactorizationMonoid.irreducible_iff_prime.mp (hf x hx))
(fun x hx => UniqueFactorizationMonoid.irreducible_iff_prime.mp (hg x hx)) h | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_unique | null |
prime_factors_irreducible [CommMonoidWithZero α] {a : α} {f : Multiset α}
(ha : Irreducible a) (pfa : (∀ b ∈ f, Prime b) ∧ f.prod ~ᵤ a) : ∃ p, a ~ᵤ p ∧ f = {p} := by
haveI := Classical.decEq α
refine @Multiset.induction_on _
(fun g => (g.prod ~ᵤ a) → (∀ b ∈ g, Prime b) → ∃ p, a ~ᵤ p ∧ g = {p}) f ?_ ?_ pfa.2 pfa.1
· intro h; exact (ha.not_isUnit (associated_one_iff_isUnit.1 (Associated.symm h))).elim
· rintro p s _ ⟨u, hu⟩ hs
use p
have hs0 : s = 0 := by
by_contra hs0
obtain ⟨q, hq⟩ := Multiset.exists_mem_of_ne_zero hs0
apply (hs q (by simp [hq])).2.1
refine (ha.isUnit_or_isUnit (?_ : _ = p * ↑u * (s.erase q).prod * _)).resolve_left ?_
· rw [mul_right_comm _ _ q, mul_assoc, ← Multiset.prod_cons, Multiset.cons_erase hq, ← hu,
mul_comm, mul_comm p _, mul_assoc]
simp
apply mt isUnit_of_mul_isUnit_left (mt isUnit_of_mul_isUnit_left _)
apply (hs p (Multiset.mem_cons_self _ _)).2.1
simp only [mul_one, Multiset.prod_cons, Multiset.prod_zero, hs0] at *
exact ⟨Associated.symm ⟨u, hu⟩, rfl⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | prime_factors_irreducible | If an irreducible has a prime factorization,
then it is an associate of one of its prime factors. |
irreducible_iff_prime_of_existsUnique_irreducible_factors [CancelCommMonoidWithZero α]
(eif : ∀ a : α, a ≠ 0 → ∃ f : Multiset α, (∀ b ∈ f, Irreducible b) ∧ f.prod ~ᵤ a)
(uif :
∀ f g : Multiset α,
(∀ x ∈ f, Irreducible x) →
(∀ x ∈ g, Irreducible x) → f.prod ~ᵤ g.prod → Multiset.Rel Associated f g)
(p : α) : Irreducible p ↔ Prime p :=
letI := Classical.decEq α
⟨ fun hpi =>
⟨hpi.ne_zero, hpi.1, fun a b ⟨x, hx⟩ =>
if hab0 : a * b = 0 then
(eq_zero_or_eq_zero_of_mul_eq_zero hab0).elim (fun ha0 => by simp [ha0]) fun hb0 => by
simp [hb0]
else by
have hx0 : x ≠ 0 := fun hx0 => by simp_all
have ha0 : a ≠ 0 := left_ne_zero_of_mul hab0
have hb0 : b ≠ 0 := right_ne_zero_of_mul hab0
obtain ⟨fx, hfx⟩ := eif x hx0
obtain ⟨fa, hfa⟩ := eif a ha0
obtain ⟨fb, hfb⟩ := eif b hb0
have h : Multiset.Rel Associated (p ::ₘ fx) (fa + fb) := by
apply uif
· exact fun i hi => (Multiset.mem_cons.1 hi).elim (fun hip => hip.symm ▸ hpi) (hfx.1 _)
· exact fun i hi => (Multiset.mem_add.1 hi).elim (hfa.1 _) (hfb.1 _)
calc
Multiset.prod (p ::ₘ fx) ~ᵤ a * b := by
rw [hx, Multiset.prod_cons]; exact hfx.2.mul_left _
_ ~ᵤ fa.prod * fb.prod := hfa.2.symm.mul_mul hfb.2.symm
_ = _ := by rw [Multiset.prod_add]
exact
let ⟨q, hqf, hq⟩ := Multiset.exists_mem_of_rel_of_mem h (Multiset.mem_cons_self p _)
(Multiset.mem_add.1 hqf).elim
(fun hqa =>
Or.inl <| hq.dvd_iff_dvd_left.2 <| hfa.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqa))
fun hqb =>
Or.inr <| hq.dvd_iff_dvd_left.2 <| hfb.2.dvd_iff_dvd_right.1 (Multiset.dvd_prod hqb)⟩,
Prime.irreducible⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | irreducible_iff_prime_of_existsUnique_irreducible_factors | null |
@[simp]
factors_one : factors (1 : α) = 0 := by
nontriviality α using factors
rw [← Multiset.rel_zero_right]
refine factors_unique irreducible_of_factor (fun x hx => (Multiset.notMem_zero x hx).elim) ?_
rw [Multiset.prod_zero]
exact factors_prod one_ne_zero | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_one | null |
exists_mem_factors_of_dvd {a p : α} (ha0 : a ≠ 0) (hp : Irreducible p) :
p ∣ a → ∃ q ∈ factors a, p ~ᵤ q := fun ⟨b, hb⟩ =>
have hb0 : b ≠ 0 := fun hb0 => by simp_all
have : Multiset.Rel Associated (p ::ₘ factors b) (factors a) :=
factors_unique
(fun _ hx => (Multiset.mem_cons.1 hx).elim (fun h => h.symm ▸ hp) (irreducible_of_factor _))
irreducible_of_factor
(Associated.symm <|
calc
Multiset.prod (factors a) ~ᵤ a := factors_prod ha0
_ = p * b := hb
_ ~ᵤ Multiset.prod (p ::ₘ factors b) := by
rw [Multiset.prod_cons]; exact (factors_prod hb0).symm.mul_left _
)
Multiset.exists_mem_of_rel_of_mem this (by simp) | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | exists_mem_factors_of_dvd | null |
exists_mem_factors {x : α} (hx : x ≠ 0) (h : ¬IsUnit x) : ∃ p, p ∈ factors x := by
obtain ⟨p', hp', hp'x⟩ := WfDvdMonoid.exists_irreducible_factor h hx
obtain ⟨p, hp, _⟩ := exists_mem_factors_of_dvd hx hp' hp'x
exact ⟨p, hp⟩
open Classical in | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | exists_mem_factors | null |
factors_mul {x y : α} (hx : x ≠ 0) (hy : y ≠ 0) :
Multiset.Rel Associated (factors (x * y)) (factors x + factors y) := by
refine
factors_unique irreducible_of_factor
(fun a ha =>
(Multiset.mem_add.mp ha).by_cases (irreducible_of_factor _) (irreducible_of_factor _))
((factors_prod (mul_ne_zero hx hy)).trans ?_)
rw [Multiset.prod_add]
exact (Associated.mul_mul (factors_prod hx) (factors_prod hy)).symm | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_mul | null |
factors_pow {x : α} (n : ℕ) :
Multiset.Rel Associated (factors (x ^ n)) (n • factors x) := by
match n with
| 0 => rw [zero_nsmul, pow_zero, factors_one, Multiset.rel_zero_right]
| n + 1 =>
by_cases h0 : x = 0
· simp [h0, zero_pow n.succ_ne_zero, nsmul_zero]
· rw [pow_succ', succ_nsmul']
refine Multiset.Rel.trans _ (factors_mul h0 (pow_ne_zero n h0)) ?_
refine Multiset.Rel.add ?_ <| factors_pow n
exact Multiset.rel_refl_of_refl_on fun y _ => Associated.refl _
@[simp] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_pow | null |
factors_pos (x : α) (hx : x ≠ 0) : 0 < factors x ↔ ¬IsUnit x := by
constructor
· intro h hx
obtain ⟨p, hp⟩ := Multiset.exists_mem_of_ne_zero h.ne'
exact (prime_of_factor _ hp).not_unit (isUnit_of_dvd_unit (dvd_of_mem_factors hp) hx)
· intro h
obtain ⟨p, hp⟩ := exists_mem_factors hx h
exact
bot_lt_iff_ne_bot.mpr
(mt Multiset.eq_zero_iff_forall_notMem.mp (not_forall.mpr ⟨p, not_not.mpr hp⟩))
open Multiset in | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_pos | null |
factors_pow_count_prod [DecidableEq α] {x : α} (hx : x ≠ 0) :
(∏ p ∈ (factors x).toFinset, p ^ (factors x).count p) ~ᵤ x :=
calc
_ = prod (∑ a ∈ toFinset (factors x), count a (factors x) • {a}) := by
simp only [prod_sum, prod_nsmul, prod_singleton]
_ = prod (factors x) := by rw [toFinset_sum_count_nsmul_eq (factors x)]
_ ~ᵤ x := factors_prod hx | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_pow_count_prod | null |
factors_rel_of_associated {a b : α} (h : Associated a b) :
Multiset.Rel Associated (factors a) (factors b) := by
rcases iff_iff_and_or_not_and_not.mp h.eq_zero_iff with (⟨rfl, rfl⟩ | ⟨ha, hb⟩)
· simp
· refine factors_unique irreducible_of_factor irreducible_of_factor ?_
exact ((factors_prod ha).trans h).trans (factors_prod hb).symm | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | factors_rel_of_associated | null |
unique' {p q : Multiset (Associates α)} :
(∀ a ∈ p, Irreducible a) → (∀ a ∈ q, Irreducible a) → p.prod = q.prod → p = q := by
apply Multiset.induction_on_multiset_quot p
apply Multiset.induction_on_multiset_quot q
intro s t hs ht eq
refine Multiset.map_mk_eq_map_mk_of_rel (UniqueFactorizationMonoid.factors_unique ?_ ?_ ?_)
· exact fun a ha => irreducible_mk.1 <| hs _ <| Multiset.mem_map_of_mem _ ha
· exact fun a ha => irreducible_mk.1 <| ht _ <| Multiset.mem_map_of_mem _ ha
have eq' : (Quot.mk Setoid.r : α → Associates α) = Associates.mk := funext quot_mk_eq_mk
rwa [eq', prod_mk, prod_mk, mk_eq_mk_iff_associated] at eq | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | unique' | null |
prod_le_prod_iff_le [Nontrivial α] {p q : Multiset (Associates α)}
(hp : ∀ a ∈ p, Irreducible a) (hq : ∀ a ∈ q, Irreducible a) : p.prod ≤ q.prod ↔ p ≤ q := by
refine ⟨?_, prod_le_prod⟩
rintro ⟨c, eqc⟩
refine Multiset.le_iff_exists_add.2 ⟨factors c, unique' hq (fun x hx ↦ ?_) ?_⟩
· obtain h | h := Multiset.mem_add.1 hx
· exact hp x h
· exact irreducible_of_factor _ h
· rw [eqc, Multiset.prod_add]
congr
refine associated_iff_eq.mp (factors_prod fun hc => ?_).symm
refine not_irreducible_zero (hq _ ?_)
rw [← prod_eq_zero_iff, eqc, hc, mul_zero] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | prod_le_prod_iff_le | null |
WfDvdMonoid.of_exists_prime_factors : WfDvdMonoid α :=
⟨by
classical
refine RelHomClass.wellFounded
(RelHom.mk ?_ ?_ : (DvdNotUnit : α → α → Prop) →r ((· < ·) : ℕ∞ → ℕ∞ → Prop)) wellFounded_lt
· intro a
by_cases h : a = 0
· exact ⊤
exact ↑(Multiset.card (Classical.choose (pf a h)))
rintro a b ⟨ane0, ⟨c, hc, b_eq⟩⟩
rw [dif_neg ane0]
by_cases h : b = 0
· simp [h, lt_top_iff_ne_top]
· rw [dif_neg h, Nat.cast_lt]
have cne0 : c ≠ 0 := by
refine mt (fun con => ?_) h
rw [b_eq, con, mul_zero]
calc
Multiset.card (Classical.choose (pf a ane0)) <
_ + Multiset.card (Classical.choose (pf c cne0)) :=
lt_add_of_pos_right _
(Multiset.card_pos.mpr fun con => hc (associated_one_iff_isUnit.mp ?_))
_ = Multiset.card (Classical.choose (pf a ane0) + Classical.choose (pf c cne0)) :=
(Multiset.card_add _ _).symm
_ = Multiset.card (Classical.choose (pf b h)) :=
Multiset.card_eq_card_of_rel
(prime_factors_unique ?_ (Classical.choose_spec (pf _ h)).1 ?_)
· convert (Classical.choose_spec (pf c cne0)).2.symm
rw [con, Multiset.prod_zero]
· intro x hadd
rw [Multiset.mem_add] at hadd
rcases hadd with h | h <;> apply (Classical.choose_spec (pf _ _)).1 _ h <;> assumption
· rw [Multiset.prod_add]
trans a * c
· apply Associated.mul_mul <;> apply (Classical.choose_spec (pf _ _)).2 <;> assumption
· rw [← b_eq]
apply (Classical.choose_spec (pf _ _)).2.symm; assumption⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | WfDvdMonoid.of_exists_prime_factors | null |
irreducible_iff_prime_of_exists_prime_factors {p : α} : Irreducible p ↔ Prime p := by
by_cases hp0 : p = 0
· simp [hp0]
refine ⟨fun h => ?_, Prime.irreducible⟩
obtain ⟨f, hf⟩ := pf p hp0
obtain ⟨q, hq, rfl⟩ := prime_factors_irreducible h hf
rw [hq.prime_iff]
exact hf.1 q (Multiset.mem_singleton_self _) | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | irreducible_iff_prime_of_exists_prime_factors | null |
UniqueFactorizationMonoid.of_exists_prime_factors : UniqueFactorizationMonoid α :=
{ WfDvdMonoid.of_exists_prime_factors pf with
irreducible_iff_prime := irreducible_iff_prime_of_exists_prime_factors pf } | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | UniqueFactorizationMonoid.of_exists_prime_factors | null |
UniqueFactorizationMonoid.iff_exists_prime_factors [CancelCommMonoidWithZero α] :
UniqueFactorizationMonoid α ↔
∀ a : α, a ≠ 0 → ∃ f : Multiset α, (∀ b ∈ f, Prime b) ∧ f.prod ~ᵤ a :=
⟨fun h => @UniqueFactorizationMonoid.exists_prime_factors _ _ h,
UniqueFactorizationMonoid.of_exists_prime_factors⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | UniqueFactorizationMonoid.iff_exists_prime_factors | null |
MulEquiv.uniqueFactorizationMonoid (e : α ≃* β) (hα : UniqueFactorizationMonoid α) :
UniqueFactorizationMonoid β := by
rw [UniqueFactorizationMonoid.iff_exists_prime_factors] at hα ⊢
intro a ha
obtain ⟨w, hp, u, h⟩ :=
hα (e.symm a) fun h =>
ha <| by
convert← map_zero e
simp [← h]
exact
⟨w.map e, fun b hb =>
let ⟨c, hc, he⟩ := Multiset.mem_map.1 hb
he ▸ (prime_iff e).2 (hp c hc),
Units.map e.toMonoidHom u,
by
rw [Multiset.prod_hom, toMonoidHom_eq_coe, Units.coe_map, MonoidHom.coe_coe, ← map_mul e, h,
apply_symm_apply]⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | MulEquiv.uniqueFactorizationMonoid | null |
MulEquiv.uniqueFactorizationMonoid_iff (e : α ≃* β) :
UniqueFactorizationMonoid α ↔ UniqueFactorizationMonoid β :=
⟨e.uniqueFactorizationMonoid, e.symm.uniqueFactorizationMonoid⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | MulEquiv.uniqueFactorizationMonoid_iff | null |
of_existsUnique_irreducible_factors [CancelCommMonoidWithZero α]
(eif : ∀ a : α, a ≠ 0 → ∃ f : Multiset α, (∀ b ∈ f, Irreducible b) ∧ f.prod ~ᵤ a)
(uif :
∀ f g : Multiset α,
(∀ x ∈ f, Irreducible x) →
(∀ x ∈ g, Irreducible x) → f.prod ~ᵤ g.prod → Multiset.Rel Associated f g) :
UniqueFactorizationMonoid α :=
UniqueFactorizationMonoid.of_exists_prime_factors
(by
convert eif using 7
simp_rw [irreducible_iff_prime_of_existsUnique_irreducible_factors eif uif])
variable {R : Type*} [CancelCommMonoidWithZero R] [UniqueFactorizationMonoid R] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | of_existsUnique_irreducible_factors | null |
isRelPrime_iff_no_prime_factors {a b : R} (ha : a ≠ 0) :
IsRelPrime a b ↔ ∀ ⦃d⦄, d ∣ a → d ∣ b → ¬Prime d :=
⟨fun h _ ha hb ↦ (·.not_unit <| h ha hb), fun h ↦ WfDvdMonoid.isRelPrime_of_no_irreducible_factors
(ha ·.1) fun _ irr ha hb ↦ h ha hb (UniqueFactorizationMonoid.irreducible_iff_prime.mp irr)⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | isRelPrime_iff_no_prime_factors | null |
dvd_of_dvd_mul_left_of_no_prime_factors {a b c : R} (ha : a ≠ 0)
(h : ∀ ⦃d⦄, d ∣ a → d ∣ c → ¬Prime d) : a ∣ b * c → a ∣ b :=
((isRelPrime_iff_no_prime_factors ha).mpr h).dvd_of_dvd_mul_right | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | dvd_of_dvd_mul_left_of_no_prime_factors | Euclid's lemma: if `a ∣ b * c` and `a` and `c` have no common prime factors, `a ∣ b`.
Compare `IsCoprime.dvd_of_dvd_mul_left`. |
dvd_of_dvd_mul_right_of_no_prime_factors {a b c : R} (ha : a ≠ 0)
(no_factors : ∀ {d}, d ∣ a → d ∣ b → ¬Prime d) : a ∣ b * c → a ∣ c := by
simpa [mul_comm b c] using dvd_of_dvd_mul_left_of_no_prime_factors ha @no_factors | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | dvd_of_dvd_mul_right_of_no_prime_factors | Euclid's lemma: if `a ∣ b * c` and `a` and `b` have no common prime factors, `a ∣ c`.
Compare `IsCoprime.dvd_of_dvd_mul_right`. |
exists_reduced_factors :
∀ a ≠ (0 : R), ∀ b,
∃ a' b' c', IsRelPrime a' b' ∧ c' * a' = a ∧ c' * b' = b := by
intro a
refine induction_on_prime a ?_ ?_ ?_
· intros
contradiction
· intro a a_unit _ b
use a, b, 1
constructor
· intro p p_dvd_a _
exact isUnit_of_dvd_unit p_dvd_a a_unit
· simp
· intro a p a_ne_zero p_prime ih_a pa_ne_zero b
by_cases h : p ∣ b
· rcases h with ⟨b, rfl⟩
obtain ⟨a', b', c', no_factor, ha', hb'⟩ := ih_a a_ne_zero b
refine ⟨a', b', p * c', @no_factor, ?_, ?_⟩
· rw [mul_assoc, ha']
· rw [mul_assoc, hb']
· obtain ⟨a', b', c', coprime, rfl, rfl⟩ := ih_a a_ne_zero b
refine ⟨p * a', b', c', ?_, mul_left_comm _ _ _, rfl⟩
intro q q_dvd_pa' q_dvd_b'
rcases p_prime.left_dvd_or_dvd_right_of_dvd_mul q_dvd_pa' with p_dvd_q | q_dvd_a'
· have : p ∣ c' * b' := dvd_mul_of_dvd_right (p_dvd_q.trans q_dvd_b') _
contradiction
exact coprime q_dvd_a' q_dvd_b' | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | exists_reduced_factors | If `a ≠ 0, b` are elements of a unique factorization domain, then dividing
out their common factor `c'` gives `a'` and `b'` with no factors in common. |
exists_reduced_factors' (a b : R) (hb : b ≠ 0) :
∃ a' b' c', IsRelPrime a' b' ∧ c' * a' = a ∧ c' * b' = b :=
let ⟨b', a', c', no_factor, hb, ha⟩ := exists_reduced_factors b hb a
⟨a', b', c', fun _ hpb hpa => no_factor hpa hpb, ha, hb⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Associated",
"Mathlib.Data.ENat.Basic",
"Mathlib.RingTheory.UniqueFactorizationDomain.Defs"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Basic.lean | exists_reduced_factors' | null |
WfDvdMonoid (α : Type*) [CommMonoidWithZero α] : Prop :=
IsWellFounded α DvdNotUnit | abbrev | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | WfDvdMonoid | Well-foundedness of the strict version of ∣, which is equivalent to the descending chain
condition on divisibility and to the ascending chain condition on
principal ideals in an integral domain. |
wellFounded_dvdNotUnit {α : Type*} [CommMonoidWithZero α] [h : WfDvdMonoid α] :
WellFounded (DvdNotUnit (α := α)) :=
h.wf | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | wellFounded_dvdNotUnit | null |
exists_irreducible_factor {a : α} (ha : ¬IsUnit a) (ha0 : a ≠ 0) :
∃ i, Irreducible i ∧ i ∣ a :=
let ⟨b, hs, hr⟩ := wellFounded_dvdNotUnit.has_min { b | b ∣ a ∧ ¬IsUnit b } ⟨a, dvd_rfl, ha⟩
⟨b,
⟨hs.2, fun c d he =>
let h := dvd_trans ⟨d, he⟩ hs.1
or_iff_not_imp_left.2 fun hc =>
of_not_not fun hd => hr c ⟨h, hc⟩ ⟨ne_zero_of_dvd_ne_zero ha0 h, d, hd, he⟩⟩,
hs.1⟩
@[elab_as_elim] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | exists_irreducible_factor | null |
induction_on_irreducible {motive : α → Prop} (a : α)
(zero : motive 0) (unit : ∀ u : α, IsUnit u → motive u)
(mul : ∀ a i : α, a ≠ 0 → Irreducible i → motive a → motive (i * a)) : motive a :=
haveI := Classical.dec
wellFounded_dvdNotUnit.fix
(fun a ih =>
if ha0 : a = 0 then ha0.substr zero
else
if hau : IsUnit a then unit a hau
else
let ⟨i, i_irred, b, hb⟩ := exists_irreducible_factor hau ha0
let hb0 : b ≠ 0 := ne_zero_of_dvd_ne_zero ha0 ⟨i, mul_comm i b ▸ hb⟩
hb.symm ▸ mul b i hb0 i_irred <| ih b ⟨hb0, i, i_irred.1, mul_comm i b ▸ hb⟩)
a | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | induction_on_irreducible | null |
exists_factors (a : α) :
a ≠ 0 → ∃ f : Multiset α, (∀ b ∈ f, Irreducible b) ∧ Associated f.prod a :=
induction_on_irreducible a (fun h => (h rfl).elim)
(fun _ hu _ => ⟨0, fun _ h => False.elim (Multiset.notMem_zero _ h), hu.unit, one_mul _⟩)
fun a i ha0 hi ih _ =>
let ⟨s, hs⟩ := ih ha0
⟨i ::ₘ s, fun b H => (Multiset.mem_cons.1 H).elim (fun h => h.symm ▸ hi) (hs.1 b), by
rw [s.prod_cons i]
exact hs.2.mul_left i⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | exists_factors | null |
not_unit_iff_exists_factors_eq (a : α) (hn0 : a ≠ 0) :
¬IsUnit a ↔ ∃ f : Multiset α, (∀ b ∈ f, Irreducible b) ∧ f.prod = a ∧ f ≠ ∅ :=
⟨fun hnu => by
obtain ⟨f, hi, u, rfl⟩ := exists_factors a hn0
obtain ⟨b, h⟩ := Multiset.exists_mem_of_ne_zero fun h : f = 0 => hnu <| by simp [h]
classical
refine ⟨(f.erase b).cons (b * u), fun a ha => ?_, ?_, Multiset.cons_ne_zero⟩
· obtain rfl | ha := Multiset.mem_cons.1 ha
exacts [Associated.irreducible ⟨u, rfl⟩ (hi b h), hi a (Multiset.mem_of_mem_erase ha)]
· rw [Multiset.prod_cons, mul_comm b, mul_assoc, Multiset.prod_erase h, mul_comm],
fun ⟨_, hi, he, hne⟩ =>
let ⟨b, h⟩ := Multiset.exists_mem_of_ne_zero hne
not_isUnit_of_not_isUnit_dvd (hi b h).not_isUnit <| he ▸ Multiset.dvd_prod h⟩ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | not_unit_iff_exists_factors_eq | null |
isRelPrime_of_no_irreducible_factors {x y : α} (nonzero : ¬(x = 0 ∧ y = 0))
(H : ∀ z : α, Irreducible z → z ∣ x → ¬z ∣ y) : IsRelPrime x y :=
isRelPrime_of_no_nonunits_factors nonzero fun _z znu znz zx zy ↦
have ⟨i, h1, h2⟩ := exists_irreducible_factor znu znz
H i h1 (h2.trans zx) (h2.trans zy) | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | isRelPrime_of_no_irreducible_factors | null |
UniqueFactorizationMonoid (α : Type*) [CancelCommMonoidWithZero α] : Prop
extends IsWellFounded α DvdNotUnit where
protected irreducible_iff_prime : ∀ {a : α}, Irreducible a ↔ Prime a | class | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | UniqueFactorizationMonoid | Unique factorization monoids are defined as `CancelCommMonoidWithZero`s with well-founded
strict divisibility relations, but this is equivalent to more familiar definitions:
Each element (except zero) is uniquely represented as a multiset of irreducible factors.
Uniqueness is only up to associated elements.
Each element (except zero) is non-uniquely represented as a multiset
of prime factors.
To define a UFD using the definition in terms of multisets
of irreducible factors, use the definition `of_existsUnique_irreducible_factors`
To define a UFD using the definition in terms of multisets
of prime factors, use the definition `of_exists_prime_factors` |
exists_prime_factors (a : α) :
a ≠ 0 → ∃ f : Multiset α, (∀ b ∈ f, Prime b) ∧ f.prod ~ᵤ a := by
simp_rw [← UniqueFactorizationMonoid.irreducible_iff_prime]
apply WfDvdMonoid.exists_factors a | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | exists_prime_factors | null |
exists_prime_iff :
(∃ (p : α), Prime p) ↔ ∃ (x : α), x ≠ 0 ∧ ¬ IsUnit x := by
refine ⟨fun ⟨p, hp⟩ ↦ ⟨p, hp.ne_zero, hp.not_unit⟩, fun ⟨x, hx₀, hxu⟩ ↦ ?_⟩
obtain ⟨f, hf, -⟩ := WfDvdMonoid.exists_irreducible_factor hxu hx₀
exact ⟨f, UniqueFactorizationMonoid.irreducible_iff_prime.mp hf⟩
@[elab_as_elim] | lemma | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | exists_prime_iff | null |
induction_on_prime {P : α → Prop} (a : α) (h₁ : P 0) (h₂ : ∀ x : α, IsUnit x → P x)
(h₃ : ∀ a p : α, a ≠ 0 → Prime p → P a → P (p * a)) : P a := by
simp_rw [← UniqueFactorizationMonoid.irreducible_iff_prime] at h₃
exact WfDvdMonoid.induction_on_irreducible a h₁ h₂ h₃ | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | induction_on_prime | null |
noncomputable factors (a : α) : Multiset α :=
if h : a = 0 then 0 else Classical.choose (UniqueFactorizationMonoid.exists_prime_factors a h) | def | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | factors | Noncomputably determines the multiset of prime factors. |
factors_prod {a : α} (ane0 : a ≠ 0) : Associated (factors a).prod a := by
rw [factors, dif_neg ane0]
exact (Classical.choose_spec (exists_prime_factors a ane0)).2
@[simp] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | factors_prod | null |
factors_zero : factors (0 : α) = 0 := by simp [factors] | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | factors_zero | null |
ne_zero_of_mem_factors {p a : α} (h : p ∈ factors a) : a ≠ 0 := by
rintro rfl
simp at h | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | ne_zero_of_mem_factors | null |
dvd_of_mem_factors {p a : α} (h : p ∈ factors a) : p ∣ a :=
dvd_trans (Multiset.dvd_prod h) (Associated.dvd (factors_prod (ne_zero_of_mem_factors h))) | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | dvd_of_mem_factors | null |
prime_of_factor {a : α} (x : α) (hx : x ∈ factors a) : Prime x := by
have ane0 := ne_zero_of_mem_factors hx
rw [factors, dif_neg ane0] at hx
exact (Classical.choose_spec (UniqueFactorizationMonoid.exists_prime_factors a ane0)).1 x hx | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | prime_of_factor | null |
irreducible_of_factor {a : α} : ∀ x : α, x ∈ factors a → Irreducible x := fun x h =>
(prime_of_factor x h).irreducible | theorem | RingTheory | [
"Mathlib.Algebra.BigOperators.Group.Multiset.Basic",
"Mathlib.Algebra.Group.Submonoid.BigOperators",
"Mathlib.Algebra.GroupWithZero.Associated",
"Mathlib.Algebra.GroupWithZero.Submonoid.Primal",
"Mathlib.Order.WellFounded"
] | Mathlib/RingTheory/UniqueFactorizationDomain/Defs.lean | irreducible_of_factor | null |
FactorSet.{u} (α : Type u) [CancelCommMonoidWithZero α] : Type u :=
WithTop (Multiset { a : Associates α // Irreducible a })
attribute [local instance] Associated.setoid | abbrev | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet. | `FactorSet α` representation elements of unique factorization domain as multisets.
`Multiset α` produced by `normalizedFactors` are only unique up to associated elements, while the
multisets in `FactorSet α` are unique by equality and restricted to irreducible elements. This
gives us a representation of each element as a unique multisets (or the added ⊤ for 0), which has a
complete lattice structure. Infimum is the greatest common divisor and supremum is the least common
multiple. |
FactorSet.coe_add {a b : Multiset { a : Associates α // Irreducible a }} :
(↑(a + b) : FactorSet α) = a + b := by norm_cast | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet.coe_add | null |
FactorSet.sup_add_inf_eq_add [DecidableEq (Associates α)] :
∀ a b : FactorSet α, a ⊔ b + a ⊓ b = a + b
| ⊤, b => show ⊤ ⊔ b + ⊤ ⊓ b = ⊤ + b by simp
| a, ⊤ => show a ⊔ ⊤ + a ⊓ ⊤ = a + ⊤ by simp
| WithTop.some a, WithTop.some b =>
show (a : FactorSet α) ⊔ b + (a : FactorSet α) ⊓ b = a + b by
rw [← WithTop.coe_sup, ← WithTop.coe_inf, ← WithTop.coe_add, ← WithTop.coe_add,
WithTop.coe_eq_coe]
exact Multiset.union_add_inter _ _ | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet.sup_add_inf_eq_add | null |
FactorSet.prod : FactorSet α → Associates α
| ⊤ => 0
| WithTop.some s => (s.map (↑)).prod
@[simp] | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet.prod | Evaluates the product of a `FactorSet` to be the product of the corresponding multiset,
or `0` if there is none. |
prod_top : (⊤ : FactorSet α).prod = 0 :=
rfl
@[simp] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | prod_top | null |
prod_coe {s : Multiset { a : Associates α // Irreducible a }} :
FactorSet.prod (s : FactorSet α) = (s.map (↑)).prod :=
rfl
@[simp] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | prod_coe | null |
prod_add : ∀ a b : FactorSet α, (a + b).prod = a.prod * b.prod
| ⊤, b => show (⊤ + b).prod = (⊤ : FactorSet α).prod * b.prod by simp
| a, ⊤ => show (a + ⊤).prod = a.prod * (⊤ : FactorSet α).prod by simp
| WithTop.some a, WithTop.some b => by
rw [← FactorSet.coe_add, prod_coe, prod_coe, prod_coe, Multiset.map_add, Multiset.prod_add]
@[gcongr] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | prod_add | null |
prod_mono : ∀ {a b : FactorSet α}, a ≤ b → a.prod ≤ b.prod
| ⊤, b, h => by
have : b = ⊤ := top_unique h
rw [this, prod_top]
| a, ⊤, _ => show a.prod ≤ (⊤ : FactorSet α).prod by simp
| WithTop.some _, WithTop.some _, h =>
prod_le_prod <| Multiset.map_le_map <| WithTop.coe_le_coe.1 <| h | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | prod_mono | null |
FactorSet.prod_eq_zero_iff [Nontrivial α] (p : FactorSet α) : p.prod = 0 ↔ p = ⊤ := by
unfold FactorSet at p
induction p -- TODO: `induction_eliminator` doesn't work with `abbrev`
· simp only [Associates.prod_top]
· rw [prod_coe, Multiset.prod_eq_zero_iff, Multiset.mem_map, eq_false WithTop.coe_ne_top,
iff_false, not_exists]
exact fun a => not_and_of_not_right _ a.prop.ne_zero | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet.prod_eq_zero_iff | null |
bcount (p : { a : Associates α // Irreducible a }) :
FactorSet α → ℕ
| ⊤ => 0
| WithTop.some s => s.count p
variable [∀ p : Associates α, Decidable (Irreducible p)] {p : Associates α} | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | bcount | `bcount p s` is the multiplicity of `p` in the FactorSet `s` (with bundled `p`). |
count (p : Associates α) : FactorSet α → ℕ :=
if hp : Irreducible p then bcount ⟨p, hp⟩ else 0
@[simp] | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | count | `count p s` is the multiplicity of the irreducible `p` in the FactorSet `s`.
If `p` is not irreducible, `count p s` is defined to be `0`. |
count_some (hp : Irreducible p) (s : Multiset _) :
count p (WithTop.some s) = s.count ⟨p, hp⟩ := by
simp only [count, dif_pos hp, bcount]
@[simp] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | count_some | null |
count_zero (hp : Irreducible p) : count p (0 : FactorSet α) = 0 := by
simp only [count, dif_pos hp, bcount, Multiset.count_zero] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | count_zero | null |
count_reducible (hp : ¬Irreducible p) : count p = 0 := dif_neg hp | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | count_reducible | null |
BfactorSetMem : { a : Associates α // Irreducible a } → FactorSet α → Prop
| _, ⊤ => True
| p, some l => p ∈ l | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | BfactorSetMem | membership in a FactorSet (bundled version) |
FactorSetMem (s : FactorSet α) (p : Associates α) : Prop :=
letI : Decidable (Irreducible p) := Classical.dec _
if hp : Irreducible p then BfactorSetMem ⟨p, hp⟩ s else False | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSetMem | `FactorSetMem p s` is the predicate that the irreducible `p` is a member of
`s : FactorSet α`.
If `p` is not irreducible, `p` is not a member of any `FactorSet`. |
@[simp]
factorSetMem_eq_mem (p : Associates α) (s : FactorSet α) : FactorSetMem s p = (p ∈ s) :=
rfl | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | factorSetMem_eq_mem | null |
mem_factorSet_top {p : Associates α} {hp : Irreducible p} : p ∈ (⊤ : FactorSet α) := by
dsimp only [Membership.mem]; dsimp only [FactorSetMem]; split_ifs; exact trivial | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | mem_factorSet_top | null |
mem_factorSet_some {p : Associates α} {hp : Irreducible p}
{l : Multiset { a : Associates α // Irreducible a }} :
p ∈ (l : FactorSet α) ↔ Subtype.mk p hp ∈ l := by
dsimp only [Membership.mem]; dsimp only [FactorSetMem]; split_ifs; rfl | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | mem_factorSet_some | null |
reducible_notMem_factorSet {p : Associates α} (hp : ¬Irreducible p) (s : FactorSet α) :
p ∉ s := fun h ↦ by
rwa [← factorSetMem_eq_mem, FactorSetMem, dif_neg hp] at h
@[deprecated (since := "2025-05-23")]
alias reducible_not_mem_factorSet := reducible_notMem_factorSet | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | reducible_notMem_factorSet | null |
irreducible_of_mem_factorSet {p : Associates α} {s : FactorSet α} (h : p ∈ s) :
Irreducible p :=
by_contra fun hp ↦ reducible_notMem_factorSet hp s h | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | irreducible_of_mem_factorSet | null |
FactorSet.unique [Nontrivial α] {p q : FactorSet α} (h : p.prod = q.prod) : p = q := by
unfold FactorSet at p q
induction p <;> induction q
· rfl
· rw [eq_comm, ← FactorSet.prod_eq_zero_iff, ← h, Associates.prod_top]
· rw [← FactorSet.prod_eq_zero_iff, h, Associates.prod_top]
· congr 1
rw [← Multiset.map_eq_map Subtype.coe_injective]
apply unique' _ _ h <;>
· intro a ha
obtain ⟨⟨a', irred⟩, -, rfl⟩ := Multiset.mem_map.mp ha
rwa [Subtype.coe_mk] | theorem | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | FactorSet.unique | null |
noncomputable factors' (a : α) : Multiset { a : Associates α // Irreducible a } :=
(factors a).pmap (fun a ha => ⟨Associates.mk a, irreducible_mk.2 ha⟩) irreducible_of_factor
@[simp] | def | RingTheory | [
"Mathlib.Data.Finsupp.Multiset",
"Mathlib.RingTheory.UniqueFactorizationDomain.Basic",
"Mathlib.Tactic.Ring"
] | Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean | factors' | This returns the multiset of irreducible factors as a `FactorSet`,
a multiset of irreducible associates `WithTop`. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.