The areas / V09. Commutative algebra I: ideals, polynomials, factorization
Mathlib.Algebra.GCDMonoid.Multiset
34 declarations. Mathlib docs · Source
GCD and LCM operations on multisets
Main definitions
Multiset.gcd- the greatest common denominator of aMultisetof elements of aGCDMonoidMultiset.lcm- the least common multiple of aMultisetof elements of aGCDMonoid
Implementation notes
TODO: simplify with a tactic and Data.Multiset.Lattice
Tags
multiset, gcd
LCM
GCD
def Multiset.lcm E3 #
{α : Type u_1} → [inst : CommMonoidWithZero α] → [NormalizedGCDMonoid α] → Multiset α → α
Least common multiple of a multiset
theorem Multiset.lcm_zero E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α], Multiset.lcm 0 = 1
theorem Multiset.lcm_cons E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (a : α) (s : Multiset α),
(a ::ₘ s).lcm = lcm a s.lcm
theorem Multiset.lcm_singleton E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {a : α}, {a}.lcm = normalize a
theorem Multiset.lcm_add E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s₁ s₂ : Multiset α),
(s₁ + s₂).lcm = lcm s₁.lcm s₂.lcm
theorem Multiset.lcm_dvd E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Multiset α} {a : α},
s.lcm ∣ a ↔ ∀ b ∈ s, b ∣ a
theorem Multiset.dvd_lcm E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Multiset α} {a : α},
a ∈ s → a ∣ s.lcm
theorem Multiset.lcm_mono E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Multiset α},
s₁ ⊆ s₂ → s₁.lcm ∣ s₂.lcm
theorem Multiset.normalize_lcm E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Multiset α),
normalize s.lcm = s.lcm
theorem Multiset.lcm_eq_zero_iff E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [Nontrivial α] (s : Multiset α),
s.lcm = 0 ↔ 0 ∈ s
theorem Multiset.lcm_ne_zero_iff E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [Nontrivial α] (s : Multiset α),
s.lcm ≠ 0 ↔ 0 ∉ s
theorem Multiset.lcm_dedup E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s : Multiset α), s.dedup.lcm = s.lcm
theorem Multiset.lcm_ndunion E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s₁ s₂ : Multiset α), (s₁.ndunion s₂).lcm = lcm s₁.lcm s₂.lcm
theorem Multiset.lcm_union E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s₁ s₂ : Multiset α), (s₁ ∪ s₂).lcm = lcm s₁.lcm s₂.lcm
theorem Multiset.lcm_ndinsert E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α] (a : α)
(s : Multiset α), (Multiset.ndinsert a s).lcm = lcm a s.lcm
def Multiset.gcd E3 #
{α : Type u_1} → [inst : CommMonoidWithZero α] → [NormalizedGCDMonoid α] → Multiset α → α
Greatest common divisor of a multiset
theorem Multiset.gcd_zero E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α], Multiset.gcd 0 = 0
theorem Multiset.gcd_cons E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (a : α) (s : Multiset α),
(a ::ₘ s).gcd = gcd a s.gcd
theorem Multiset.gcd_singleton E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {a : α}, {a}.gcd = normalize a
theorem Multiset.gcd_add E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s₁ s₂ : Multiset α),
(s₁ + s₂).gcd = gcd s₁.gcd s₂.gcd
theorem Multiset.dvd_gcd E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Multiset α} {a : α},
a ∣ s.gcd ↔ ∀ b ∈ s, a ∣ b
theorem Multiset.gcd_dvd E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Multiset α} {a : α},
a ∈ s → s.gcd ∣ a
theorem Multiset.gcd_mono E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Multiset α},
s₁ ⊆ s₂ → s₂.gcd ∣ s₁.gcd
theorem Multiset.normalize_gcd E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Multiset α),
normalize s.gcd = s.gcd
theorem Multiset.gcd_eq_zero_iff E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Multiset α),
s.gcd = 0 ↔ ∀ x ∈ s, x = 0
theorem Multiset.gcd_ne_zero_iff E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Multiset α),
s.gcd ≠ 0 ↔ ∃ x ∈ s, x ≠ 0
theorem Multiset.gcd_map_mul E1 #
∀ {α : Type u_2} [inst : CommMonoidWithZero α] [inst_1 : StrongNormalizedGCDMonoid α] (a : α) (s : Multiset α),
(Multiset.map (fun x ↦ a * x) s).gcd = normalize a * s.gcd
theorem Multiset.associated_gcd_map_mul E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (a : α) (s : Multiset α),
Associated (Multiset.map (fun x ↦ a * x) s).gcd (a * s.gcd)
theorem Multiset.gcd_dedup E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s : Multiset α), s.dedup.gcd = s.gcd
theorem Multiset.gcd_ndunion E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s₁ s₂ : Multiset α), (s₁.ndunion s₂).gcd = gcd s₁.gcd s₂.gcd
theorem Multiset.gcd_union E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α]
(s₁ s₂ : Multiset α), (s₁ ∪ s₂).gcd = gcd s₁.gcd s₂.gcd
theorem Multiset.gcd_ndinsert E0 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : DecidableEq α] (a : α)
(s : Multiset α), (Multiset.ndinsert a s).gcd = gcd a s.gcd
theorem Multiset.extract_gcd' E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s t : Multiset α),
(∃ x ∈ s, x ≠ 0) → s = Multiset.map (fun x ↦ s.gcd * x) t → t.gcd = 1
theorem Multiset.extract_gcd E1 #
∀ {α : Type u_1} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Multiset α),
s ≠ 0 → ∃ t, s = Multiset.map (fun x ↦ s.gcd * x) t ∧ t.gcd = 1