Documentation

Mathlib.Algebra.Group.ModEq

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 #

See also #

SModEq is a generalisation to arbitrary submodules.

TODO #

def AddCommGroup.ModEq {M : Type u_1} [AddCommMonoid M] (p a b : M) :

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.

Equations
Instances For

    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.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem AddCommGroup.modEq_iff_nsmul {M : Type u_1} [AddCommMonoid M] {a b p : M} :
      a ≡ b [PMOD p] ↔ ∃ (m : ℕ), ∃ (n : ℕ), m • p + a = n • p + b
      @[simp]
      theorem AddCommGroup.modEq_refl {M : Type u_1} [AddCommMonoid M] {p : M} (a : M) :
      a ≡ a [PMOD p]
      theorem AddCommGroup.modEq_rfl {M : Type u_1} [AddCommMonoid M] {a p : M} :
      a ≡ a [PMOD p]
      theorem AddCommGroup.ModEq.symm {M : Type u_1} [AddCommMonoid M] {a b p : M} (h : a ≡ b [PMOD p]) :
      b ≡ a [PMOD p]
      theorem AddCommGroup.modEq_comm {M : Type u_1} [AddCommMonoid M] {a b p : M} :
      a ≡ b [PMOD p] ↔ b ≡ a [PMOD p]
      theorem AddCommGroup.ModEq.trans {M : Type u_1} [AddCommMonoid M] {a b c p : M} (hab : a ≡ b [PMOD p]) (hbc : b ≡ c [PMOD p]) :
      a ≡ c [PMOD p]
      @[simp]
      theorem AddCommGroup.modEq_zero {M : Type u_1} [AddCommMonoid M] {a b : M} :
      a ≡ b [PMOD 0] ↔ a = b
      @[simp]
      theorem AddCommGroup.self_modEq_zero {M : Type u_1} [AddCommMonoid M] {p : M} :
      p ≡ 0 [PMOD p]
      theorem AddCommGroup.add_nsmul_modEq {M : Type u_1} [AddCommMonoid M] {a p : M} (n : ℕ) :
      a + n • p ≡ a [PMOD p]
      theorem AddCommGroup.nsmul_add_modEq {M : Type u_1} [AddCommMonoid M] {a p : M} (n : ℕ) :
      n • p + a ≡ a [PMOD p]
      theorem AddCommGroup.ModEq.add {M : Type u_1} [AddCommMonoid M] {a b c d p : M} (hab : a ≡ b [PMOD p]) (hcd : c ≡ d [PMOD p]) :
      a + c ≡ b + d [PMOD p]
      theorem AddCommGroup.ModEq.add_left {M : Type u_1} [AddCommMonoid M] {a b p : M} (c : M) (h : a ≡ b [PMOD p]) :
      c + a ≡ c + b [PMOD p]
      theorem AddCommGroup.ModEq.add_right {M : Type u_1} [AddCommMonoid M] {a b p : M} (c : M) (h : a ≡ b [PMOD p]) :
      a + c ≡ b + c [PMOD p]
      theorem AddCommGroup.ModEq.of_nsmul {M : Type u_1} [AddCommMonoid M] {a b p : M} {n : ℕ} :
      a ≡ b [PMOD n • p] → a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.nsmul {M : Type u_1} [AddCommMonoid M] {a b p : M} {n : ℕ} (h : a ≡ b [PMOD p]) :
      n • a ≡ n • b [PMOD n • p]
      theorem AddCommGroup.ModEq.add_nsmul {M : Type u_1} [AddCommMonoid M] {a b p : M} (n : ℕ) :
      a ≡ b [PMOD p] → a + n • p ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.nsmul_add {M : Type u_1} [AddCommMonoid M] {a b p : M} (n : ℕ) :
      a ≡ b [PMOD p] → n • p + a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.map {M : Type u_1} [AddCommMonoid M] {a b p : M} {N : Type u_2} {F : Type u_3} [AddCommMonoid N] [FunLike F M N] [AddMonoidHomClass F M N] (f : F) (h : a ≡ b [PMOD p]) :
      f a ≡ f b [PMOD f p]
      theorem AddCommGroup.map_modEq_iff {M : Type u_1} [AddCommMonoid M] {a b p : M} {N : Type u_2} {F : Type u_3} [AddCommMonoid N] [FunLike F M N] [AddMonoidHomClass F M N] (f : F) (hf : Function.Injective ⇑f) :
      f a ≡ f b [PMOD f p] ↔ a ≡ b [PMOD p]
      @[simp]
      theorem AddCommGroup.nsmul_modEq_nsmul {M : Type u_1} [AddCommMonoid M] {a b p : M} [IsAddTorsionFree M] {n : ℕ} (hn : n ≠ 0) :
      n • a ≡ n • b [PMOD n • p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.nsmul_cancel {M : Type u_1} [AddCommMonoid M] {a b p : M} [IsAddTorsionFree M] {n : ℕ} (hn : n ≠ 0) :
      n • a ≡ n • b [PMOD n • p] → a ≡ b [PMOD p]

      Alias of the forward direction of AddCommGroup.nsmul_modEq_nsmul.

      @[simp]
      theorem AddCommGroup.ModEq.add_iff_left {M : Type u_1} [AddCancelCommMonoid M] {a b c d p : M} (h : a ≡ b [PMOD p]) :
      a + c ≡ b + d [PMOD p] ↔ c ≡ d [PMOD p]
      @[simp]
      theorem AddCommGroup.ModEq.add_iff_right {M : Type u_1} [AddCancelCommMonoid M] {a b c d p : M} (h : c ≡ d [PMOD p]) :
      a + c ≡ b + d [PMOD p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.add_left_cancel {M : Type u_1} [AddCancelCommMonoid M] {a b c d p : M} (h : 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 {M : Type u_1} [AddCancelCommMonoid M] {a b c d p : M} (h : 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' {M : Type u_1} [AddCancelCommMonoid M] {a b p : M} (c : M) :
      c + a ≡ c + b [PMOD p] → a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.add_right_cancel' {M : Type u_1} [AddCancelCommMonoid M] {a b p : M} (c : M) :
      a + c ≡ b + c [PMOD p] → a ≡ b [PMOD p]
      @[simp]
      theorem AddCommGroup.add_modEq_left {M : Type u_1} [AddCancelCommMonoid M] {a b p : M} :
      a + b ≡ a [PMOD p] ↔ b ≡ 0 [PMOD p]
      @[simp]
      theorem AddCommGroup.add_modEq_right {M : Type u_1} [AddCancelCommMonoid M] {a b p : M} :
      a + b ≡ b [PMOD p] ↔ a ≡ 0 [PMOD p]
      theorem AddCommGroup.modEq_iff_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a ≡ b [PMOD p] ↔ ∃ (m : ℤ), m • p = b - a
      theorem AddCommGroup.modEq_iff_zsmul' {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a ≡ b [PMOD p] ↔ ∃ (m : ℤ), b - a = m • p
      @[simp]
      theorem AddCommGroup.neg_modEq_neg {G : Type u_1} [AddCommGroup G] {p a b : G} :
      -a ≡ -b [PMOD p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.of_neg {G : Type u_1} [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 {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a ≡ b [PMOD p] → -a ≡ -b [PMOD p]

      Alias of the reverse direction of AddCommGroup.neg_modEq_neg.

      @[simp]
      theorem AddCommGroup.modEq_neg {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a ≡ b [PMOD -p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.neg' {G : Type u_1} [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.of_neg' {G : Type u_1} [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_sub {G : Type u_1} [AddCommGroup G] (a b : G) :
      a ≡ b [PMOD b - a]
      @[simp]
      theorem AddCommGroup.zsmul_modEq_zero {G : Type u_1} [AddCommGroup G] {p : G} (z : ℤ) :
      z • p ≡ 0 [PMOD p]
      theorem AddCommGroup.add_zsmul_modEq {G : Type u_1} [AddCommGroup G] {p a : G} (z : ℤ) :
      a + z • p ≡ a [PMOD p]
      theorem AddCommGroup.zsmul_add_modEq {G : Type u_1} [AddCommGroup G] {p a : G} (z : ℤ) :
      z • p + a ≡ a [PMOD p]
      theorem AddCommGroup.ModEq.add_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} (z : ℤ) :
      a ≡ b [PMOD p] → a + z • p ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.zsmul_add {G : Type u_1} [AddCommGroup G] {p a b : G} (z : ℤ) :
      a ≡ b [PMOD p] → z • p + a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.of_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} {z : ℤ} (h : a ≡ b [PMOD z • p]) :
      a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} {z : ℤ} (h : a ≡ b [PMOD p]) :
      z • a ≡ z • b [PMOD z • p]
      @[simp]
      theorem AddCommGroup.zsmul_modEq_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} {z : ℤ} [IsAddTorsionFree G] (hn : z ≠ 0) :
      z • a ≡ z • b [PMOD z • p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.zsmul_cancel {G : Type u_1} [AddCommGroup G] {p a b : G} {z : ℤ} [IsAddTorsionFree G] (hn : z ≠ 0) :
      z • a ≡ z • b [PMOD z • p] → a ≡ b [PMOD p]

      Alias of the forward direction of AddCommGroup.zsmul_modEq_zsmul.

      @[simp]
      theorem AddCommGroup.ModEq.sub_iff_left {G : Type u_1} [AddCommGroup G] {p a₁ a₂ b₁ b₂ : G} (h : a₁ ≡ b₁ [PMOD p]) :
      a₁ - a₂ ≡ b₁ - b₂ [PMOD p] ↔ a₂ ≡ b₂ [PMOD p]
      @[simp]
      theorem AddCommGroup.ModEq.sub_iff_right {G : Type u_1} [AddCommGroup G] {p a₁ a₂ b₁ b₂ : G} (h : a₂ ≡ b₂ [PMOD p]) :
      a₁ - a₂ ≡ b₁ - b₂ [PMOD p] ↔ a₁ ≡ b₁ [PMOD p]
      theorem AddCommGroup.ModEq.sub {G : Type u_1} [AddCommGroup G] {p a₁ a₂ b₁ b₂ : G} (h : 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 {G : Type u_1} [AddCommGroup G] {p a₁ a₂ b₁ b₂ : G} (h : 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 {G : Type u_1} [AddCommGroup G] {p a₁ a₂ b₁ b₂ : G} (h : 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 {G : Type u_1} [AddCommGroup G] {p a b : G} (c : G) (h : a ≡ b [PMOD p]) :
      c - a ≡ c - b [PMOD p]
      theorem AddCommGroup.ModEq.sub_right {G : Type u_1} [AddCommGroup G] {p a b : G} (c : G) (h : a ≡ b [PMOD p]) :
      a - c ≡ b - c [PMOD p]
      theorem AddCommGroup.ModEq.sub_left_cancel' {G : Type u_1} [AddCommGroup G] {p a b : G} (c : G) :
      c - a ≡ c - b [PMOD p] → a ≡ b [PMOD p]
      theorem AddCommGroup.ModEq.sub_right_cancel' {G : Type u_1} [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' {G : Type u_1} [AddCommGroup G] {p a b c : G} :
      a ≡ b - c [PMOD p] ↔ c + a ≡ b [PMOD p]
      theorem AddCommGroup.modEq_sub_iff_add_modEq {G : Type u_1} [AddCommGroup G] {p a b c : G} :
      a ≡ b - c [PMOD p] ↔ a + c ≡ b [PMOD p]
      theorem AddCommGroup.sub_modEq_iff_modEq_add' {G : Type u_1} [AddCommGroup G] {p a b c : G} :
      a - b ≡ c [PMOD p] ↔ a ≡ b + c [PMOD p]
      theorem AddCommGroup.sub_modEq_iff_modEq_add {G : Type u_1} [AddCommGroup G] {p a b c : G} :
      a - b ≡ c [PMOD p] ↔ a ≡ c + b [PMOD p]
      @[simp]
      theorem AddCommGroup.sub_modEq_zero {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a - b ≡ 0 [PMOD p] ↔ a ≡ b [PMOD p]
      theorem AddCommGroup.modEq_iff_eq_add_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} :
      a ≡ b [PMOD p] ↔ ∃ (z : ℤ), b = a + z • p
      theorem AddCommGroup.modEq_zero_iff_eq_zsmul {G : Type u_1} [AddCommGroup G] {p a : G} :
      a ≡ 0 [PMOD p] ↔ ∃ (z : ℤ), a = z • p
      theorem AddCommGroup.not_modEq_iff_ne_add_zsmul {G : Type u_1} [AddCommGroup G] {p a b : G} :
      ¬a ≡ b [PMOD p] ↔ ∀ (z : ℤ), b ≠ a + z • p
      theorem AddCommGroup.modEq_nsmul_cases {G : Type u_1} [AddCommGroup G] {p a b : G} (n : ℕ) (hn : n ≠ 0) :
      a ≡ b [PMOD p] ↔ ∃ (i : ℕ), 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 {G : Type u_1} [AddCommGroup G] {p a b : G} (n : ℕ) (hn : n ≠ 0) :
      a ≡ b [PMOD p] → ∃ (i : ℕ), 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.