The areas / V09. Commutative algebra I: ideals, polynomials, factorization
Mathlib.Algebra.GCDMonoid.Finset
46 declarations. Mathlib docs · Source
GCD and LCM operations on finsets
Main definitions
Finset.gcd- the greatest common denominator of aFinsetof elements of aGCDMonoidFinset.lcm- the least common multiple of aFinsetof elements of aGCDMonoid
Implementation notes
Many of the proofs use the lemmas gcd_def and lcm_def, which relate Finset.gcd
and Finset.lcm to Multiset.gcd and Multiset.lcm.
TODO: simplify with a tactic and Data.Finset.Lattice
Tags
finset, gcd
lcm
gcd
def Finset.lcm E3 #
{α : Type u_2} → {β : Type u_3} → [inst : CommMonoidWithZero α] → [NormalizedGCDMonoid α] → Finset β → (β → α) → α
Least common multiple of a finite set
theorem Finset.lcm_def E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, s.lcm f = (Multiset.map f s.val).lcm
theorem Finset.lcm_empty E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {f : β → α}, ∅.lcm f = 1
theorem Finset.lcm_dvd_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a
theorem Finset.lcm_dvd E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a
theorem Finset.dvd_lcm E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {b : β}, b ∈ s → f b ∣ s.lcm f
theorem Finset.lcm_insert E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [inst_2 : DecidableEq β] {b : β}, (insert b s).lcm f = lcm (f b) (s.lcm f)
theorem Finset.lcm_singleton E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {f : β → α} {b : β},
{b}.lcm f = normalize (f b)
theorem Finset.normalize_lcm E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, normalize (s.lcm f) = s.lcm f
theorem Finset.lcm_union E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f : β → α} [inst_2 : DecidableEq β], (s₁ ∪ s₂).lcm f = lcm (s₁.lcm f) (s₂.lcm f)
theorem Finset.lcm_congr E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f g : β → α}, s₁ = s₂ → (∀ a ∈ s₂, f a = g a) → s₁.lcm f = s₂.lcm g
theorem Finset.lcm_mono_fun E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f g : β → α}, (∀ b ∈ s, f b ∣ g b) → s.lcm f ∣ s.lcm g
theorem Finset.lcm_mono E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f : β → α}, s₁ ⊆ s₂ → s₁.lcm f ∣ s₂.lcm f
theorem Finset.lcm_image E1 #
∀ {α : Type u_2} {β : Type u_3} {γ : Type u_4} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α]
{f : β → α} [inst_2 : DecidableEq β] {g : γ → β} (s : Finset γ), (Finset.image g s).lcm f = s.lcm (f ∘ g)
theorem Finset.lcm_eq_lcm_image E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [inst_2 : DecidableEq α], s.lcm f = (Finset.image f s).lcm id
theorem Finset.lcm_eq_zero_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [Nontrivial α], s.lcm f = 0 ↔ ∃ x ∈ s, f x = 0
theorem Finset.lcm_ne_zero_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [Nontrivial α], s.lcm f ≠ 0 ↔ ∀ x ∈ s, f x ≠ 0
def Finset.gcd E3 #
{α : Type u_2} → {β : Type u_3} → [inst : CommMonoidWithZero α] → [NormalizedGCDMonoid α] → Finset β → (β → α) → α
Greatest common divisor of a finite set
theorem Finset.gcd_def E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, s.gcd f = (Multiset.map f s.val).gcd
theorem Finset.gcd_empty E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {f : β → α}, ∅.gcd f = 0
theorem Finset.dvd_gcd_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, a ∣ s.gcd f ↔ ∀ b ∈ s, a ∣ f b
theorem Finset.gcd_dvd E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {b : β}, b ∈ s → s.gcd f ∣ f b
theorem Finset.dvd_gcd E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, (∀ b ∈ s, a ∣ f b) → a ∣ s.gcd f
theorem Finset.gcd_cons E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {b : β} (h : b ∉ s), (Finset.cons b s h).gcd f = gcd (f b) (s.gcd f)
theorem Finset.gcd_insert E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [inst_2 : DecidableEq β] {b : β}, (insert b s).gcd f = gcd (f b) (s.gcd f)
theorem Finset.gcd_singleton E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {f : β → α} {b : β},
{b}.gcd f = normalize (f b)
theorem Finset.normalize_gcd E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, normalize (s.gcd f) = s.gcd f
theorem Finset.gcd_union E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f : β → α} [inst_2 : DecidableEq β], (s₁ ∪ s₂).gcd f = gcd (s₁.gcd f) (s₂.gcd f)
theorem Finset.gcd_congr E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f g : β → α}, s₁ = s₂ → (∀ a ∈ s₂, f a = g a) → s₁.gcd f = s₂.gcd g
theorem Finset.gcd_mono_fun E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f g : β → α}, (∀ b ∈ s, f b ∣ g b) → s.gcd f ∣ s.gcd g
theorem Finset.gcd_mono E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s₁ s₂ : Finset β}
{f : β → α}, s₁ ⊆ s₂ → s₂.gcd f ∣ s₁.gcd f
theorem Finset.gcd_image E1 #
∀ {α : Type u_2} {β : Type u_3} {γ : Type u_4} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α]
{f : β → α} [inst_2 : DecidableEq β] {g : γ → β} (s : Finset γ), (Finset.image g s).gcd f = s.gcd (f ∘ g)
theorem Finset.gcd_eq_gcd_image E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [inst_2 : DecidableEq α], s.gcd f = (Finset.image f s).gcd id
theorem Finset.gcd_eq_zero_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, s.gcd f = 0 ↔ ∀ x ∈ s, f x = 0
theorem Finset.gcd_ne_zero_iff E0 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α}, s.gcd f ≠ 0 ↔ ∃ x ∈ s, f x ≠ 0
theorem Finset.gcd_eq_gcd_filter_ne_zero E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
{f : β → α} [inst_2 : DecidablePred fun x ↦ f x = 0], s.gcd f = {x ∈ s | f x ≠ 0}.gcd f
theorem Finset.gcd_mul_left E1 #
∀ {β : Type u_3} {α : Type u_5} [inst : CommMonoidWithZero α] [inst_1 : StrongNormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, (s.gcd fun x ↦ a * f x) = normalize a * s.gcd f
theorem Finset.gcd_mul_right E1 #
∀ {β : Type u_3} {α : Type u_5} [inst : CommMonoidWithZero α] [inst_1 : StrongNormalizedGCDMonoid α] {s : Finset β}
{f : β → α} {a : α}, (s.gcd fun x ↦ f x * a) = s.gcd f * normalize a
theorem Finset.gcd_mul_left' E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Finset β)
(f : β → α) (a : α), Associated (s.gcd fun x ↦ a * f x) (a * s.gcd f)
theorem Finset.gcd_mul_right' E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] (s : Finset β)
(f : β → α) (a : α), Associated (s.gcd fun x ↦ f x * a) (s.gcd f * a)
theorem Finset.extract_gcd' E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
(f g : β → α), (∃ x ∈ s, f x ≠ 0) → (∀ b ∈ s, f b = s.gcd f * g b) → s.gcd g = 1
theorem Finset.extract_gcd E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β}
(f : β → α), s.Nonempty → ∃ g, (∀ b ∈ s, f b = s.gcd f * g b) ∧ s.gcd g = 1
theorem Finset.gcd_div_eq_one E1 #
∀ {ι : Type u_1} {α : Type u_2} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : Div α]
[MulDivCancelClass α] {f : ι → α} {s : Finset ι} {i : ι}, i ∈ s → f i ≠ 0 → (s.gcd fun j ↦ f j / s.gcd f) = 1
Given a nonempty Finset s and a function f from s to ℕ, if d = s.gcd,
then the gcd of (f i) / d is equal to 1.
theorem Finset.gcd_div_id_eq_one E1 #
∀ {α : Type u_2} [inst : CommMonoidWithZero α] [inst_1 : NormalizedGCDMonoid α] [inst_2 : Div α] [MulDivCancelClass α]
{s : Finset α} {a : α}, a ∈ s → a ≠ 0 → (s.gcd fun b ↦ b / s.gcd id) = 1
theorem Finset.gcd_eq_of_dvd_sub E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : CommRing α] [inst_1 : NormalizedGCDMonoid α] {s : Finset β} {f g : β → α}
{a : α}, (∀ x ∈ s, a ∣ f x - g x) → gcd a (s.gcd f) = gcd a (s.gcd g)
theorem Finset.Int.finsetGcd_nonneg E1 #
∀ {ι : Type u_1} {s : Finset ι} {f : ι → ℤ}, 0 ≤ s.gcd f
The gcd of a finset of integers is nonnegative.