# mathlibdocumentation

algebra.divisibility

# Divisibility

This file defines the basics of the divisibility relation in the context of (comm_) monoids (_with_zero).

## Main definitions

• monoid.has_dvd

## Implementation notes

The divisibility relation is defined for all monoids, and as such, depends on the order of multiplication if the monoid is not commutative. There are two possible conventions for divisibility in the noncommutative context, and this relation follows the convention for ordinals, so a | b is defined as ∃ c, b = a * c.

## Tags

divisibility, divides

@[instance]
def monoid_has_dvd {α : Type u_1} [monoid α] :

There are two possible conventions for divisibility, which coincide in a comm_monoid. This matches the convention for ordinals.

Equations
theorem dvd.intro {α : Type u_1} [monoid α] {a b : α} (c : α) :
a * c = ba b

theorem exists_eq_mul_right_of_dvd {α : Type u_1} [monoid α] {a b : α} :
a b(∃ (c : α), b = a * c)

theorem dvd.elim {α : Type u_1} [monoid α] {P : Prop} {a b : α} :
a b(∀ (c : α), b = a * c → P) → P

@[simp]
theorem dvd_refl {α : Type u_1} [monoid α] (a : α) :
a a

theorem dvd_trans {α : Type u_1} [monoid α] {a b c : α} :
a bb ca c

theorem one_dvd {α : Type u_1} [monoid α] (a : α) :
1 a

@[simp]
theorem dvd_mul_right {α : Type u_1} [monoid α] (a b : α) :
a a * b

theorem dvd_mul_of_dvd_left {α : Type u_1} [monoid α] {a b : α} (h : a b) (c : α) :
a b * c

theorem dvd_of_mul_right_dvd {α : Type u_1} [monoid α] {a b c : α} :
a * b ca c

theorem dvd.intro_left {α : Type u_1} [comm_monoid α] {a b : α} (c : α) :
c * a = ba b

theorem exists_eq_mul_left_of_dvd {α : Type u_1} [comm_monoid α] {a b : α} :
a b(∃ (c : α), b = c * a)

theorem dvd.elim_left {α : Type u_1} [comm_monoid α] {a b : α} {P : Prop} :
a b(∀ (c : α), b = c * a → P) → P

@[simp]
theorem dvd_mul_left {α : Type u_1} [comm_monoid α] (a b : α) :
a b * a

theorem dvd_mul_of_dvd_right {α : Type u_1} [comm_monoid α] {a b : α} (h : a b) (c : α) :
a c * b

theorem mul_dvd_mul {α : Type u_1} [comm_monoid α] {a b c d : α} :
a bc da * c b * d

theorem mul_dvd_mul_left {α : Type u_1} [comm_monoid α] (a : α) {b c : α} :
b ca * b a * c

theorem mul_dvd_mul_right {α : Type u_1} [comm_monoid α] {a b : α} (h : a b) (c : α) :
a * c b * c

theorem dvd_of_mul_left_dvd {α : Type u_1} [comm_monoid α] {a b c : α} :
a * b cb c

theorem eq_zero_of_zero_dvd {α : Type u_1} {a : α} :
0 aa = 0

@[simp]
theorem zero_dvd_iff {α : Type u_1} {a : α} :
0 a a = 0

Given an element a of a commutative monoid with zero, there exists another element whose product with zero equals a iff a equals zero.

@[simp]
theorem dvd_zero {α : Type u_1} (a : α) :
a 0

theorem mul_dvd_mul_iff_left {α : Type u_1} {a b c : α} :
a 0(a * b a * c b c)

Given two elements b, c of a cancel_monoid_with_zero and a nonzero element a, a*b divides a*c iff b divides c.

theorem mul_dvd_mul_iff_right {α : Type u_1} {a b c : α} :
c 0(a * c b * c a b)

Given two elements a, b of a commutative cancel_monoid_with_zero and a nonzero element c, a*c divides b*c iff a divides b.

### Units in various monoids

theorem units.coe_dvd {α : Type u_1} [monoid α] {a : α} {u : units α} :
u a

Elements of the unit group of a monoid represented as elements of the monoid divide any element of the monoid.

theorem units.dvd_mul_right {α : Type u_1} [monoid α] {a b : α} {u : units α} :
a b * u a b

In a monoid, an element a divides an element b iff a divides all associates of b.

theorem units.mul_right_dvd {α : Type u_1} [monoid α] {a b : α} {u : units α} :
a * u b a b

In a monoid, an element a divides an element b iff all associates of a divide b.

theorem units.dvd_mul_left {α : Type u_1} [comm_monoid α] {a b : α} {u : units α} :
a (u) * b a b

In a commutative monoid, an element a divides an element b iff a divides all left associates of b.

theorem units.mul_left_dvd {α : Type u_1} [comm_monoid α] {a b : α} {u : units α} :
(u) * a b a b

In a commutative monoid, an element a divides an element b iff all left associates of a divide b.

@[simp]
theorem is_unit.dvd {α : Type u_1} [monoid α] {a u : α} :
u a

Units of a monoid divide any element of the monoid.

@[simp]
theorem is_unit.dvd_mul_right {α : Type u_1} [monoid α] {a b u : α} :
(a b * u a b)

@[simp]
theorem is_unit.mul_right_dvd {α : Type u_1} [monoid α] {a b u : α} :
(a * u b a b)

In a monoid, an element a divides an element b iff all associates of a divide b.

@[simp]
theorem is_unit.dvd_mul_left {α : Type u_1} [comm_monoid α] (a b u : α) :
(a u * b a b)

In a commutative monoid, an element a divides an element b iff a divides all left associates of b.

@[simp]
theorem is_unit.mul_left_dvd {α : Type u_1} [comm_monoid α] (a b u : α) :
(u * a b a b)

In a commutative monoid, an element a divides an element b iff all left associates of a divide b.

def dvd_not_unit {α : Type u_1}  :
α → α → Prop

dvd_not_unit a b expresses that a divides b "strictly", i.e. that b divided by a is not a unit.

Equations
theorem dvd_not_unit_of_dvd_of_not_dvd {α : Type u_1} {a b : α} :
a b¬b a b