Skip to content

Commit

Permalink
feat(data/nat/pow): add theorem nat.pow_mod (#13551)
Browse files Browse the repository at this point in the history
Add theorem that states `∀ (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n`.
  • Loading branch information
slerpyyy committed Apr 21, 2022
1 parent 090e59d commit afe1421
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/data/nat/pow.lean
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ alias nat.sq_sub_sq ← nat.pow_two_sub_pow_two

/-! ### `pow` and `mod` / `dvd` -/

theorem pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n :=
begin
induction b with b ih,
refl, simp [pow_succ, nat.mul_mod, ih],
end

theorem mod_pow_succ {b : ℕ} (w m : ℕ) :
m % (b^succ w) = b * (m/b % b^w) + m % b :=
begin
Expand Down

0 comments on commit afe1421

Please sign in to comment.