mathlib3 documentation

algebra.gcd_monoid.basic

Monoids with normalization functions, gcd, and lcm #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines extra structures on cancel_comm_monoid_with_zeros, including is_domains.

Main Definitions #

For the normalized_gcd_monoid instances on ℕ and ℤ, see ring_theory.int.basic.

Implementation Notes #

TODO #

Tags #

divisibility, gcd, lcm, normalize

@[class]
structure normalization_monoid (α : Type u_2) [cancel_comm_monoid_with_zero α] :
Type u_2

Normalization monoid: multiplying with norm_unit gives a normal form for associated elements.

Instances of this typeclass
Instances of other typeclasses for normalization_monoid

Chooses an element of each associate class, by multiplying by norm_unit

Equations
theorem normalize_eq_normalize {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] {a b : α} (hab : a ∣ b) (hba : b ∣ a) :
theorem dvd_antisymm_of_normalize_eq {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] {a b : α} (ha : ⇑normalize a = a) (hb : ⇑normalize b = b) (hab : a ∣ b) (hba : b ∣ a) :
a = b
@[protected]

Maps an element of associates back to the normalized element of its associate class

Equations
theorem associates.out_mul {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] (a b : associates α) :
(a * b).out = a.out * b.out
@[class]
structure gcd_monoid (α : Type u_2) [cancel_comm_monoid_with_zero α] :
Type u_2

GCD monoid: a cancel_comm_monoid_with_zero with gcd (greatest common divisor) and lcm (least common multiple) operations, determined up to a unit. The type class focuses on gcd and we derive the corresponding lcm facts from gcd.

Instances of this typeclass
Instances of other typeclasses for gcd_monoid
@[class]
structure normalized_gcd_monoid (α : Type u_2) [cancel_comm_monoid_with_zero α] :
Type u_2

Normalized GCD monoid: a cancel_comm_monoid_with_zero with normalization and gcd (greatest common divisor) and lcm (least common multiple) operations. In this setting gcd and lcm form a bounded lattice on the associated elements where gcd is the infimum, lcm is the supremum, 1 is bottom, and 0 is top. The type class focuses on gcd and we derive the corresponding lcm facts from gcd.

Instances of this typeclass
Instances of other typeclasses for normalized_gcd_monoid
theorem gcd_mul_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
theorem dvd_gcd_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b c : α) :
theorem gcd_comm' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
theorem gcd_eq_normalize {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] {a b c : α} (habc : gcd_monoid.gcd a b ∣ c) (hcab : c ∣ gcd_monoid.gcd a b) :
@[simp]
theorem gcd_eq_zero_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
gcd_monoid.gcd a b = 0 ↔ a = 0 ∧ b = 0
@[simp]
theorem gcd_one_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a : α) :
@[simp]
theorem gcd_one_left' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a : α) :
@[simp]
theorem gcd_one_right {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a : α) :
@[simp]
theorem gcd_one_right' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a : α) :
theorem gcd_dvd_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c d : α} (hab : a ∣ b) (hcd : c ∣ d) :
@[simp]
@[simp]
theorem gcd_mul_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b c : α) :
theorem gcd_mul_left' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b c : α) :
@[simp]
theorem gcd_mul_right {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b c : α) :
@[simp]
theorem gcd_mul_right' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b c : α) :
theorem gcd_eq_left_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b : α) (h : ⇑normalize a = a) :
theorem gcd_eq_right_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b : α) (h : ⇑normalize b = b) :
theorem gcd_dvd_gcd_mul_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (m n k : α) :
theorem associated.gcd_eq_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] {m n : α} (h : associated m n) (k : α) :
theorem dvd_gcd_mul_of_dvd_mul {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {m n k : α} (H : k ∣ m * n) :
theorem dvd_mul_gcd_of_dvd_mul {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {m n k : α} (H : k ∣ m * n) :
theorem exists_dvd_and_dvd_of_dvd_mul {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {m n k : α} (H : k ∣ m * n) :
∃ (d₁ d₂ : α), d₁ ∣ m ∧ d₂ ∣ n ∧ k = d₁ * d₂

Represent a divisor of m * n as a product of a divisor of m and a divisor of n.

In other words, the nonzero elements of a gcd_monoid form a decomposition monoid (more widely known as a pre-Schreier domain in the context of rings).

Note: In general, this representation is highly non-unique.

See nat.prod_dvd_and_dvd_of_dvd_prod for a constructive version on ℕ.

theorem dvd_mul {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {k m n : α} :
k ∣ m * n ↔ ∃ (d₁ d₂ : α), d₁ ∣ m ∧ d₂ ∣ n ∧ k = d₁ * d₂
theorem gcd_pow_right_dvd_pow_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b : α} {k : ℕ} :
theorem gcd_pow_left_dvd_pow_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b : α} {k : ℕ} :
theorem pow_dvd_of_mul_eq_pow {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c d₁ d₂ : α} (ha : a ≠ 0) (hab : is_unit (gcd_monoid.gcd a b)) {k : ℕ} (h : a * b = c ^ k) (hc : c = d₁ * d₂) (hd₁ : d₁ ∣ a) :
d₁ ^ k ≠ 0 ∧ d₁ ^ k ∣ a
theorem exists_associated_pow_of_mul_eq_pow {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c : α} (hab : is_unit (gcd_monoid.gcd a b)) {k : ℕ} (h : a * b = c ^ k) :
∃ (d : α), associated (d ^ k) a
theorem exists_eq_pow_of_mul_eq_pow {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] [unique αˣ] {a b c : α} (hab : is_unit (gcd_monoid.gcd a b)) {k : ℕ} (h : a * b = c ^ k) :
∃ (d : α), a = d ^ k
theorem gcd_greatest {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] {a b d : α} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ (e : α), e ∣ a → e ∣ b → e ∣ d) :
theorem gcd_greatest_associated {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b d : α} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ (e : α), e ∣ a → e ∣ b → e ∣ d) :
theorem is_unit_gcd_of_eq_mul_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {x y x' y' : α} (ex : x = gcd_monoid.gcd x y * x') (ey : y = gcd_monoid.gcd x y * y') (h : gcd_monoid.gcd x y ≠ 0) :
theorem extract_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (x y : α) :
∃ (x' y' : α), x = gcd_monoid.gcd x y * x' ∧ y = gcd_monoid.gcd x y * y' ∧ is_unit (gcd_monoid.gcd x' y')
theorem lcm_dvd_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c : α} :
theorem dvd_lcm_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
theorem dvd_lcm_right {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
theorem lcm_dvd {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c : α} (hab : a ∣ b) (hcb : c ∣ b) :
@[simp]
theorem lcm_eq_zero_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
gcd_monoid.lcm a b = 0 ↔ a = 0 ∨ b = 0
theorem lcm_comm' {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (a b : α) :
theorem lcm_eq_normalize {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] {a b c : α} (habc : gcd_monoid.lcm a b ∣ c) (hcab : c ∣ gcd_monoid.lcm a b) :
theorem lcm_dvd_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] {a b c d : α} (hab : a ∣ b) (hcd : c ∣ d) :
@[simp]
@[simp]
@[simp]
theorem lcm_eq_one_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b : α) :
gcd_monoid.lcm a b = 1 ↔ a ∣ 1 ∧ b ∣ 1
@[simp]
theorem lcm_mul_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b c : α) :
@[simp]
theorem lcm_mul_right {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b c : α) :
theorem lcm_eq_left_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b : α) (h : ⇑normalize a = a) :
theorem lcm_eq_right_iff {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalized_gcd_monoid α] (a b : α) (h : ⇑normalize b = b) :
theorem lcm_dvd_lcm_mul_left {α : Type u_1} [cancel_comm_monoid_with_zero α] [gcd_monoid α] (m n k : α) :
@[simp]
theorem normalize_eq {α : Type u_1} [cancel_comm_monoid_with_zero α] [unique αˣ] (x : α) :
theorem gcd_eq_of_dvd_sub_right {α : Type u_1} [comm_ring α] [is_domain α] [normalized_gcd_monoid α] {a b c : α} (h : a ∣ b - c) :
theorem gcd_eq_of_dvd_sub_left {α : Type u_1} [comm_ring α] [is_domain α] [normalized_gcd_monoid α] {a b c : α} (h : a ∣ b - c) :
noncomputable def gcd_monoid_of_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [decidable_eq α] (gcd : α → α → α) (gcd_dvd_left : ∀ (a b : α), gcd a b ∣ a) (gcd_dvd_right : ∀ (a b : α), gcd a b ∣ b) (dvd_gcd : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd c b) :

Define gcd_monoid on a structure just from the gcd and its properties.

Equations
noncomputable def normalized_gcd_monoid_of_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] [decidable_eq α] (gcd : α → α → α) (gcd_dvd_left : ∀ (a b : α), gcd a b ∣ a) (gcd_dvd_right : ∀ (a b : α), gcd a b ∣ b) (dvd_gcd : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd c b) (normalize_gcd : ∀ (a b : α), ⇑normalize (gcd a b) = gcd a b) :

Define normalized_gcd_monoid on a structure just from the gcd and its properties.

Equations
noncomputable def gcd_monoid_of_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [decidable_eq α] (lcm : α → α → α) (dvd_lcm_left : ∀ (a b : α), a ∣ lcm a b) (dvd_lcm_right : ∀ (a b : α), b ∣ lcm a b) (lcm_dvd : ∀ {a b c : α}, c ∣ a → b ∣ a → lcm c b ∣ a) :

Define gcd_monoid on a structure just from the lcm and its properties.

Equations
noncomputable def normalized_gcd_monoid_of_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] [decidable_eq α] (lcm : α → α → α) (dvd_lcm_left : ∀ (a b : α), a ∣ lcm a b) (dvd_lcm_right : ∀ (a b : α), b ∣ lcm a b) (lcm_dvd : ∀ {a b c : α}, c ∣ a → b ∣ a → lcm c b ∣ a) (normalize_lcm : ∀ (a b : α), ⇑normalize (lcm a b) = lcm a b) :

Define normalized_gcd_monoid on a structure just from the lcm and its properties.

Equations
noncomputable def gcd_monoid_of_exists_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [decidable_eq α] (h : ∀ (a b : α), ∃ (c : α), ∀ (d : α), d ∣ a ∧ d ∣ b ↔ d ∣ c) :

Define a gcd_monoid structure on a monoid just from the existence of a gcd.

Equations
noncomputable def normalized_gcd_monoid_of_exists_gcd {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] [decidable_eq α] (h : ∀ (a b : α), ∃ (c : α), ∀ (d : α), d ∣ a ∧ d ∣ b ↔ d ∣ c) :

Define a normalized_gcd_monoid structure on a monoid just from the existence of a gcd.

Equations
noncomputable def gcd_monoid_of_exists_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [decidable_eq α] (h : ∀ (a b : α), ∃ (c : α), ∀ (d : α), a ∣ d ∧ b ∣ d ↔ c ∣ d) :

Define a gcd_monoid structure on a monoid just from the existence of an lcm.

Equations
noncomputable def normalized_gcd_monoid_of_exists_lcm {α : Type u_1} [cancel_comm_monoid_with_zero α] [normalization_monoid α] [decidable_eq α] (h : ∀ (a b : α), ∃ (c : α), ∀ (d : α), a ∣ d ∧ b ∣ d ↔ c ∣ d) :

Define a normalized_gcd_monoid structure on a monoid just from the existence of an lcm.

Equations
@[protected, instance]
Equations
@[simp]
theorem comm_group_with_zero.normalize_eq_one (G₀ : Type u_2) [comm_group_with_zero G₀] [decidable_eq G₀] {a : G₀} (h0 : a ≠ 0) :