Mathlib.Algebra.Group.ModEq
71 declarations. Mathlib docs · Source
Equality modulo an element
This file defines equality modulo an element in an additive commutative monoid.
In case of a group, a and b are congruent modulo p iff b - a ∈ zmultiples p.
In case of a monoid, the definition is a bit more complicated, and it is given with the use case of natural numbers in mind.
Main definitions
a ≡ b [PMOD p]:aandbare congruent modulop.
See also
SModEq is a generalisation to arbitrary submodules.
TODO
- Delete
Nat.ModEqandInt.ModEqin favour ofAddCommGroup.ModEq. - Relate to
SModEq.
def AddCommGroup.ModEq E1 #
{M : Type u_1} → [AddCommMonoid M] → M → M → M → Prop
a ≡ b [PMOD p] means that b is congruent to a modulo p.
If a, b are elements of an additive group,
then a ≡ b [PMOD p] iff m • p = b - a for some m : ℤ, see modEq_iff_zsmul below.
For additive commutative monoid, the definition is given by modEq_iff_nsmul.
Equivalently (as shown in Algebra.Order.ToIntervalMod), b does not lie in the open interval
(a, a + p) modulo p, or toIcoMod hp a disagrees with toIocMod hp a at b, or
toIcoDiv hp a disagrees with toIocDiv hp a at b.
def AddCommGroup.«term_≡_[PMOD_]» E1 #
Lean.TrailingParserDescr
a ≡ b [PMOD p] means that b is congruent to a modulo p.
If a, b are elements of an additive group,
then a ≡ b [PMOD p] iff m • p = b - a for some m : ℤ, see modEq_iff_zsmul below.
For additive commutative monoid, the definition is given by modEq_iff_nsmul.
Equivalently (as shown in Algebra.Order.ToIntervalMod), b does not lie in the open interval
(a, a + p) modulo p, or toIcoMod hp a disagrees with toIocMod hp a at b, or
toIcoDiv hp a disagrees with toIocDiv hp a at b.
theorem AddCommGroup.modEq_iff_nsmul E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M}, a ≡ b [PMOD p] ↔ ∃ m n, m • p + a = n • p + b
theorem AddCommGroup.modEq_refl E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {p : M} (a : M), a ≡ a [PMOD p]
theorem AddCommGroup.modEq_rfl E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a p : M}, a ≡ a [PMOD p]
instance AddCommGroup.instReflModEq E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {p : M}, Std.Refl (AddCommGroup.ModEq p)
theorem AddCommGroup.ModEq.symm E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M}, a ≡ b [PMOD p] → b ≡ a [PMOD p]
instance AddCommGroup.instSymmModEq E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {p : M}, Std.Symm (AddCommGroup.ModEq p)
theorem AddCommGroup.modEq_comm E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M}, a ≡ b [PMOD p] ↔ b ≡ a [PMOD p]
theorem AddCommGroup.ModEq.trans E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b c p : M}, a ≡ b [PMOD p] → b ≡ c [PMOD p] → a ≡ c [PMOD p]
instance AddCommGroup.instIsTransModEq E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {p : M}, IsTrans M (AddCommGroup.ModEq p)
theorem AddCommGroup.modEq_zero E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b : M}, a ≡ b [PMOD 0] ↔ a = b
theorem AddCommGroup.self_modEq_zero E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {p : M}, p ≡ 0 [PMOD p]
theorem AddCommGroup.add_nsmul_modEq E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a p : M} (n : ℕ), a + n • p ≡ a [PMOD p]
theorem AddCommGroup.nsmul_add_modEq E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a p : M} (n : ℕ), n • p + a ≡ a [PMOD p]
theorem AddCommGroup.ModEq.add E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b c d p : M}, a ≡ b [PMOD p] → c ≡ d [PMOD p] → a + c ≡ b + d [PMOD p]
theorem AddCommGroup.ModEq.add_left E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} (c : M), a ≡ b [PMOD p] → c + a ≡ c + b [PMOD p]
theorem AddCommGroup.ModEq.add_right E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} (c : M), a ≡ b [PMOD p] → a + c ≡ b + c [PMOD p]
theorem AddCommGroup.ModEq.of_nsmul E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} {n : ℕ}, a ≡ b [PMOD n • p] → a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.nsmul E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} {n : ℕ}, a ≡ b [PMOD p] → n • a ≡ n • b [PMOD n • p]
theorem AddCommGroup.ModEq.add_nsmul E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} (n : ℕ), a ≡ b [PMOD p] → a + n • p ≡ b [PMOD p]
theorem AddCommGroup.ModEq.nsmul_add E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} (n : ℕ), a ≡ b [PMOD p] → n • p + a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.map E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} {N : Type u_2} {F : Type u_3} [inst_1 : AddCommMonoid N]
[inst_2 : FunLike F M N] [AddMonoidHomClass F M N] (f : F), a ≡ b [PMOD p] → f a ≡ f b [PMOD f p]
theorem AddCommGroup.map_modEq_iff E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} {N : Type u_2} {F : Type u_3} [inst_1 : AddCommMonoid N]
[inst_2 : FunLike F M N] [AddMonoidHomClass F M N] (f : F),
Function.Injective ⇑f → (f a ≡ f b [PMOD f p] ↔ a ≡ b [PMOD p])
theorem AddCommGroup.nsmul_modEq_nsmul E0 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} [HasUniqueDiv M] {n : ℕ},
n ≠ 0 → (n • a ≡ n • b [PMOD n • p] ↔ a ≡ b [PMOD p])
theorem AddCommGroup.ModEq.nsmul_cancel E1 #
∀ {M : Type u_1} [inst : AddCommMonoid M] {a b p : M} [HasUniqueDiv M] {n : ℕ},
n ≠ 0 → n • a ≡ n • b [PMOD n • p] → a ≡ b [PMOD p]
Alias of the forward direction of AddCommGroup.nsmul_modEq_nsmul.
theorem AddCommGroup.ModEq.add_iff_left E0 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b c d p : M},
a ≡ b [PMOD p] → (a + c ≡ b + d [PMOD p] ↔ c ≡ d [PMOD p])
theorem AddCommGroup.ModEq.add_iff_right E0 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b c d p : M},
c ≡ d [PMOD p] → (a + c ≡ b + d [PMOD p] ↔ a ≡ b [PMOD p])
theorem AddCommGroup.ModEq.add_left_cancel E1 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b c d p : M},
a ≡ b [PMOD p] → a + c ≡ b + d [PMOD p] → c ≡ d [PMOD p]
Alias of the forward direction of AddCommGroup.ModEq.add_iff_left.
theorem AddCommGroup.ModEq.add_right_cancel E1 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b c d p : M},
c ≡ d [PMOD p] → a + c ≡ b + d [PMOD p] → a ≡ b [PMOD p]
Alias of the forward direction of AddCommGroup.ModEq.add_iff_right.
theorem AddCommGroup.ModEq.add_left_cancel' E1 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b p : M} (c : M), c + a ≡ c + b [PMOD p] → a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.add_right_cancel' E1 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b p : M} (c : M), a + c ≡ b + c [PMOD p] → a ≡ b [PMOD p]
theorem AddCommGroup.add_modEq_left E0 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b p : M}, a + b ≡ a [PMOD p] ↔ b ≡ 0 [PMOD p]
theorem AddCommGroup.add_modEq_right E0 #
∀ {M : Type u_1} [inst : AddCancelCommMonoid M] {a b p : M}, a + b ≡ b [PMOD p] ↔ a ≡ 0 [PMOD p]
theorem AddCommGroup.modEq_iff_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD p] ↔ ∃ m, m • p = b - a
theorem AddCommGroup.modEq_iff_zsmul' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD p] ↔ ∃ m, b - a = m • p
theorem AddCommGroup.neg_modEq_neg E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, -a ≡ -b [PMOD p] ↔ a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.of_neg E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, -a ≡ -b [PMOD p] → a ≡ b [PMOD p]
Alias of the forward direction of AddCommGroup.neg_modEq_neg.
theorem AddCommGroup.ModEq.neg E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD p] → -a ≡ -b [PMOD p]
Alias of the reverse direction of AddCommGroup.neg_modEq_neg.
theorem AddCommGroup.modEq_neg E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD -p] ↔ a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.of_neg' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD -p] → a ≡ b [PMOD p]
Alias of the forward direction of AddCommGroup.modEq_neg.
theorem AddCommGroup.ModEq.neg' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD p] → a ≡ b [PMOD -p]
Alias of the reverse direction of AddCommGroup.modEq_neg.
theorem AddCommGroup.modEq_sub E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] (a b : G), a ≡ b [PMOD b - a]
theorem AddCommGroup.zsmul_modEq_zero E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p : G} (z : ℤ), z • p ≡ 0 [PMOD p]
theorem AddCommGroup.add_zsmul_modEq E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a : G} (z : ℤ), a + z • p ≡ a [PMOD p]
theorem AddCommGroup.zsmul_add_modEq E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a : G} (z : ℤ), z • p + a ≡ a [PMOD p]
theorem AddCommGroup.ModEq.add_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (z : ℤ), a ≡ b [PMOD p] → a + z • p ≡ b [PMOD p]
theorem AddCommGroup.ModEq.zsmul_add E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (z : ℤ), a ≡ b [PMOD p] → z • p + a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.of_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} {z : ℤ}, a ≡ b [PMOD z • p] → a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} {z : ℤ}, a ≡ b [PMOD p] → z • a ≡ z • b [PMOD z • p]
theorem AddCommGroup.zsmul_modEq_zsmul E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} {z : ℤ} [HasUniqueDiv G],
z ≠ 0 → (z • a ≡ z • b [PMOD z • p] ↔ a ≡ b [PMOD p])
theorem AddCommGroup.ModEq.zsmul_cancel E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} {z : ℤ} [HasUniqueDiv G],
z ≠ 0 → z • a ≡ z • b [PMOD z • p] → a ≡ b [PMOD p]
Alias of the forward direction of AddCommGroup.zsmul_modEq_zsmul.
theorem AddCommGroup.ModEq.sub_iff_left E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a₁ a₂ b₁ b₂ : G},
a₁ ≡ b₁ [PMOD p] → (a₁ - a₂ ≡ b₁ - b₂ [PMOD p] ↔ a₂ ≡ b₂ [PMOD p])
theorem AddCommGroup.ModEq.sub_iff_right E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a₁ a₂ b₁ b₂ : G},
a₂ ≡ b₂ [PMOD p] → (a₁ - a₂ ≡ b₁ - b₂ [PMOD p] ↔ a₁ ≡ b₁ [PMOD p])
theorem AddCommGroup.ModEq.sub E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a₁ a₂ b₁ b₂ : G},
a₁ ≡ b₁ [PMOD p] → a₂ ≡ b₂ [PMOD p] → a₁ - a₂ ≡ b₁ - b₂ [PMOD p]
Alias of the reverse direction of AddCommGroup.ModEq.sub_iff_left.
theorem AddCommGroup.ModEq.sub_left_cancel E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a₁ a₂ b₁ b₂ : G},
a₁ ≡ b₁ [PMOD p] → a₁ - a₂ ≡ b₁ - b₂ [PMOD p] → a₂ ≡ b₂ [PMOD p]
Alias of the forward direction of AddCommGroup.ModEq.sub_iff_left.
theorem AddCommGroup.ModEq.sub_right_cancel E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a₁ a₂ b₁ b₂ : G},
a₂ ≡ b₂ [PMOD p] → a₁ - a₂ ≡ b₁ - b₂ [PMOD p] → a₁ ≡ b₁ [PMOD p]
Alias of the forward direction of AddCommGroup.ModEq.sub_iff_right.
theorem AddCommGroup.ModEq.sub_left E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (c : G), a ≡ b [PMOD p] → c - a ≡ c - b [PMOD p]
theorem AddCommGroup.ModEq.sub_right E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (c : G), a ≡ b [PMOD p] → a - c ≡ b - c [PMOD p]
theorem AddCommGroup.ModEq.sub_left_cancel' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (c : G), c - a ≡ c - b [PMOD p] → a ≡ b [PMOD p]
theorem AddCommGroup.ModEq.sub_right_cancel' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (c : G), a - c ≡ b - c [PMOD p] → a ≡ b [PMOD p]
theorem AddCommGroup.modEq_sub_iff_add_modEq' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b c : G}, a ≡ b - c [PMOD p] ↔ c + a ≡ b [PMOD p]
theorem AddCommGroup.modEq_sub_iff_add_modEq E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b c : G}, a ≡ b - c [PMOD p] ↔ a + c ≡ b [PMOD p]
theorem AddCommGroup.sub_modEq_iff_modEq_add' E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b c : G}, a - b ≡ c [PMOD p] ↔ a ≡ b + c [PMOD p]
theorem AddCommGroup.sub_modEq_iff_modEq_add E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b c : G}, a - b ≡ c [PMOD p] ↔ a ≡ c + b [PMOD p]
theorem AddCommGroup.sub_modEq_zero E0 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a - b ≡ 0 [PMOD p] ↔ a ≡ b [PMOD p]
theorem AddCommGroup.modEq_iff_eq_add_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, a ≡ b [PMOD p] ↔ ∃ z, b = a + z • p
theorem AddCommGroup.modEq_zero_iff_eq_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a : G}, a ≡ 0 [PMOD p] ↔ ∃ z, a = z • p
theorem AddCommGroup.not_modEq_iff_ne_add_zsmul E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G}, ¬a ≡ b [PMOD p] ↔ ∀ (z : ℤ), b ≠ a + z • p
theorem AddCommGroup.modEq_nsmul_cases E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (n : ℕ),
n ≠ 0 → (a ≡ b [PMOD p] ↔ ∃ i < n, a ≡ b + i • p [PMOD n • p])
If a ≡ b [PMOD p], then mod n • p there are n cases.
theorem AddCommGroup.ModEq.nsmul_cases E1 #
∀ {G : Type u_1} [inst : AddCommGroup G] {p a b : G} (n : ℕ),
n ≠ 0 → a ≡ b [PMOD p] → ∃ i < n, a ≡ b + i • p [PMOD n • p]
Alias of the forward direction of AddCommGroup.modEq_nsmul_cases.
If a ≡ b [PMOD p], then mod n • p there are n cases.