2015-05-23 05:38:42 +00:00
|
|
|
|
/-
|
|
|
|
|
Copyright (c) 2015 Jeremy Avigad. All rights reserved.
|
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
Author: Jeremy Avigad
|
|
|
|
|
|
|
|
|
|
The power function on the integers.
|
|
|
|
|
-/
|
2015-08-17 03:23:03 +00:00
|
|
|
|
import data.int.basic data.int.order data.int.div algebra.group_power data.nat.power
|
2015-05-23 05:38:42 +00:00
|
|
|
|
|
|
|
|
|
namespace int
|
2015-10-08 18:01:57 +00:00
|
|
|
|
open - [notations] algebra
|
2015-05-23 05:38:42 +00:00
|
|
|
|
|
2015-10-09 21:50:17 +00:00
|
|
|
|
definition int_has_pow_nat [reducible] [instance] [priority int.prio] : has_pow_nat int :=
|
2015-10-09 19:47:55 +00:00
|
|
|
|
has_pow_nat.mk has_pow_nat.pow_nat
|
2015-05-23 05:38:42 +00:00
|
|
|
|
|
2015-10-08 18:01:57 +00:00
|
|
|
|
/-
|
2015-08-17 03:23:03 +00:00
|
|
|
|
definition nmul (n : ℕ) (a : ℤ) : ℤ := algebra.nmul n a
|
2015-09-30 15:06:31 +00:00
|
|
|
|
infix [priority int.prio] ⬝ := nmul
|
2015-08-17 03:23:03 +00:00
|
|
|
|
definition imul (i : ℤ) (a : ℤ) : ℤ := algebra.imul i a
|
2015-10-08 18:01:57 +00:00
|
|
|
|
-/
|
2015-05-23 05:38:42 +00:00
|
|
|
|
|
2015-10-08 18:01:57 +00:00
|
|
|
|
open nat
|
|
|
|
|
theorem of_nat_pow (a n : ℕ) : of_nat (a^n) = (of_nat a)^n :=
|
|
|
|
|
begin
|
|
|
|
|
induction n with n ih,
|
|
|
|
|
apply eq.refl,
|
|
|
|
|
rewrite [pow_succ, pow_succ, of_nat_mul, ih]
|
2015-08-17 03:23:03 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-05-23 05:38:42 +00:00
|
|
|
|
end int
|