Skip to content

Commit

Permalink
chore: add Nat.self_sub_mod lemma (#5306)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em authored Sep 12, 2024
1 parent da0d309 commit adfd6c0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Init/Data/Nat/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,15 @@ theorem mul_mod (a b n : Nat) : a * b % n = (a % n) * (b % n) % n := by
theorem add_mod (a b n : Nat) : (a + b) % n = ((a % n) + (b % n)) % n := by
rw [add_mod_mod, mod_add_mod]

@[simp] theorem self_sub_mod (n k : Nat) [NeZero k] : (n - k) % n = n - k := by
cases n with
| zero => simp
| succ n =>
rw [mod_eq_of_lt]
cases k with
| zero => simp_all
| succ k => omega

/-! ### pow -/

theorem pow_succ' {m n : Nat} : m ^ n.succ = m * m ^ n := by
Expand Down

0 comments on commit adfd6c0

Please sign in to comment.