Skip to content

Commit

Permalink
feat: Data/Int/ModEq add theorem modEq_sub_fac, compliment modEq_add_…
Browse files Browse the repository at this point in the history
…fac (#6040)

Easy of use function to compliment modEq_add_fac, the statement that :

a = b [ZMOD n] implies a - c * n = b [ZMOD n]
  • Loading branch information
Archie authored and semorrison committed Aug 14, 2023
1 parent 802c018 commit 6eb71e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Mathlib/Data/Int/ModEq.lean
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ theorem modEq_add_fac {a b n : ℤ} (c : ℤ) (ha : a ≡ b [ZMOD n]) : a + n *
_ ≡ b [ZMOD n] := by rw [add_zero]
#align int.modeq_add_fac Int.modEq_add_fac

theorem modEq_sub_fac {a b n : ℤ} (c : ℤ) (ha : a ≡ b [ZMOD n]) : a - n * c ≡ b [ZMOD n] := by
convert Int.modEq_add_fac (-c) ha using 1
ring

theorem modEq_add_fac_self {a t n : ℤ} : a + n * t ≡ a [ZMOD n] :=
modEq_add_fac _ ModEq.rfl
#align int.modeq_add_fac_self Int.modEq_add_fac_self
Expand Down

0 comments on commit 6eb71e4

Please sign in to comment.