2015-07-08 01:27:55 +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
|
|
|
|
|
|
2015-12-19 20:45:24 +00:00
|
|
|
|
Properties of the power operation in various structures, including ordered rings and fields.
|
2015-07-08 01:27:55 +00:00
|
|
|
|
-/
|
2015-08-17 03:23:03 +00:00
|
|
|
|
import .group_power .ordered_field
|
2015-07-08 01:27:55 +00:00
|
|
|
|
open nat
|
|
|
|
|
|
|
|
|
|
variable {A : Type}
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
section semiring
|
|
|
|
|
variable [s : semiring A]
|
|
|
|
|
include s
|
|
|
|
|
|
2015-10-09 21:50:17 +00:00
|
|
|
|
definition semiring_has_pow_nat [reducible] [instance] : has_pow_nat A :=
|
|
|
|
|
monoid_has_pow_nat
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
theorem zero_pow {m : ℕ} (mpos : m > 0) : 0^m = (0 : A) :=
|
2015-10-08 18:01:57 +00:00
|
|
|
|
have h₁ : ∀ m : nat, (0 : A)^(succ m) = (0 : A),
|
|
|
|
|
begin
|
|
|
|
|
intro m, induction m,
|
|
|
|
|
rewrite pow_one,
|
|
|
|
|
apply zero_mul
|
|
|
|
|
end,
|
2015-08-17 03:23:03 +00:00
|
|
|
|
obtain m' (h₂ : m = succ m'), from exists_eq_succ_of_pos mpos,
|
|
|
|
|
show 0^m = 0, by rewrite h₂; apply h₁
|
|
|
|
|
|
|
|
|
|
end semiring
|
|
|
|
|
|
|
|
|
|
section integral_domain
|
|
|
|
|
variable [s : integral_domain A]
|
|
|
|
|
include s
|
|
|
|
|
|
2015-10-09 21:50:17 +00:00
|
|
|
|
definition integral_domain_has_pow_nat [reducible] [instance] : has_pow_nat A :=
|
|
|
|
|
monoid_has_pow_nat
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
theorem eq_zero_of_pow_eq_zero {a : A} {m : ℕ} (H : a^m = 0) : a = 0 :=
|
|
|
|
|
or.elim (eq_zero_or_pos m)
|
|
|
|
|
(suppose m = 0,
|
|
|
|
|
by rewrite [`m = 0` at H, pow_zero at H]; apply absurd H (ne.symm zero_ne_one))
|
|
|
|
|
(suppose m > 0,
|
|
|
|
|
have h₁ : ∀ m, a^succ m = 0 → a = 0,
|
|
|
|
|
begin
|
|
|
|
|
intro m,
|
|
|
|
|
induction m with m ih,
|
|
|
|
|
{rewrite pow_one; intros; assumption},
|
|
|
|
|
rewrite pow_succ,
|
|
|
|
|
intro H,
|
|
|
|
|
cases eq_zero_or_eq_zero_of_mul_eq_zero H with h₃ h₄,
|
|
|
|
|
assumption,
|
|
|
|
|
exact ih h₄
|
|
|
|
|
end,
|
|
|
|
|
obtain m' (h₂ : m = succ m'), from exists_eq_succ_of_pos `m > 0`,
|
|
|
|
|
show a = 0, by rewrite h₂ at H; apply h₁ m' H)
|
|
|
|
|
|
2015-08-27 17:29:19 +00:00
|
|
|
|
theorem pow_ne_zero_of_ne_zero {a : A} {m : ℕ} (H : a ≠ 0) : a^m ≠ 0 :=
|
|
|
|
|
assume H', H (eq_zero_of_pow_eq_zero H')
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
end integral_domain
|
|
|
|
|
|
2015-08-27 17:29:19 +00:00
|
|
|
|
section division_ring
|
|
|
|
|
variable [s : division_ring A]
|
|
|
|
|
include s
|
|
|
|
|
|
|
|
|
|
theorem division_ring.pow_ne_zero_of_ne_zero {a : A} {m : ℕ} (H : a ≠ 0) : a^m ≠ 0 :=
|
|
|
|
|
or.elim (eq_zero_or_pos m)
|
|
|
|
|
(suppose m = 0,
|
|
|
|
|
by rewrite [`m = 0`, pow_zero]; exact (ne.symm zero_ne_one))
|
|
|
|
|
(suppose m > 0,
|
|
|
|
|
have h₁ : ∀ m, a^succ m ≠ 0,
|
|
|
|
|
begin
|
|
|
|
|
intro m,
|
|
|
|
|
induction m with m ih,
|
|
|
|
|
{rewrite pow_one; assumption},
|
|
|
|
|
rewrite pow_succ,
|
|
|
|
|
apply division_ring.mul_ne_zero H ih
|
|
|
|
|
end,
|
|
|
|
|
obtain m' (h₂ : m = succ m'), from exists_eq_succ_of_pos `m > 0`,
|
|
|
|
|
show a^m ≠ 0, by rewrite h₂; apply h₁ m')
|
|
|
|
|
|
|
|
|
|
end division_ring
|
|
|
|
|
|
2015-07-08 01:27:55 +00:00
|
|
|
|
section linear_ordered_semiring
|
|
|
|
|
variable [s : linear_ordered_semiring A]
|
|
|
|
|
include s
|
|
|
|
|
|
|
|
|
|
theorem pow_pos_of_pos {x : A} (i : ℕ) (H : x > 0) : x^i > 0 :=
|
|
|
|
|
begin
|
|
|
|
|
induction i with [j, ih],
|
|
|
|
|
{show (1 : A) > 0, from zero_lt_one},
|
2015-08-14 15:00:16 +00:00
|
|
|
|
{show x^(succ j) > 0, from mul_pos H ih}
|
2015-07-08 01:27:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem pow_nonneg_of_nonneg {x : A} (i : ℕ) (H : x ≥ 0) : x^i ≥ 0 :=
|
|
|
|
|
begin
|
2015-08-17 03:23:03 +00:00
|
|
|
|
induction i with j ih,
|
2015-07-08 01:27:55 +00:00
|
|
|
|
{show (1 : A) ≥ 0, from le_of_lt zero_lt_one},
|
2015-08-14 15:00:16 +00:00
|
|
|
|
{show x^(succ j) ≥ 0, from mul_nonneg H ih}
|
2015-07-08 01:27:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem pow_le_pow_of_le {x y : A} (i : ℕ) (H₁ : 0 ≤ x) (H₂ : x ≤ y) : x^i ≤ y^i :=
|
|
|
|
|
begin
|
2015-08-17 03:23:03 +00:00
|
|
|
|
induction i with i ih,
|
2015-07-08 01:27:55 +00:00
|
|
|
|
{rewrite *pow_zero, apply le.refl},
|
|
|
|
|
rewrite *pow_succ,
|
2015-08-14 15:00:16 +00:00
|
|
|
|
have H : 0 ≤ x^i, from pow_nonneg_of_nonneg i H₁,
|
|
|
|
|
apply mul_le_mul H₂ ih H (le.trans H₁ H₂)
|
2015-07-08 01:27:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem pow_ge_one {x : A} (i : ℕ) (xge1 : x ≥ 1) : x^i ≥ 1 :=
|
|
|
|
|
assert H : x^i ≥ 1^i, from pow_le_pow_of_le i (le_of_lt zero_lt_one) xge1,
|
|
|
|
|
by rewrite one_pow at H; exact H
|
|
|
|
|
|
|
|
|
|
theorem pow_gt_one {x : A} {i : ℕ} (xgt1 : x > 1) (ipos : i > 0) : x^i > 1 :=
|
|
|
|
|
assert xpos : x > 0, from lt.trans zero_lt_one xgt1,
|
|
|
|
|
begin
|
|
|
|
|
induction i with [i, ih],
|
2015-10-22 21:35:27 +00:00
|
|
|
|
{exfalso, exact !lt.irrefl ipos},
|
2015-07-08 01:27:55 +00:00
|
|
|
|
have xige1 : x^i ≥ 1, from pow_ge_one _ (le_of_lt xgt1),
|
2015-10-07 23:44:47 +00:00
|
|
|
|
rewrite [pow_succ, -mul_one 1],
|
2015-07-08 01:27:55 +00:00
|
|
|
|
apply mul_lt_mul xgt1 xige1 zero_lt_one,
|
|
|
|
|
apply le_of_lt xpos
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end linear_ordered_semiring
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
section decidable_linear_ordered_comm_ring
|
|
|
|
|
variable [s : decidable_linear_ordered_comm_ring A]
|
|
|
|
|
include s
|
|
|
|
|
|
2015-10-09 21:50:17 +00:00
|
|
|
|
definition decidable_linear_ordered_comm_ring_has_pow_nat [reducible] [instance] : has_pow_nat A :=
|
|
|
|
|
monoid_has_pow_nat
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
theorem abs_pow (a : A) (n : ℕ) : abs (a^n) = abs a^n :=
|
|
|
|
|
begin
|
|
|
|
|
induction n with n ih,
|
|
|
|
|
rewrite [*pow_zero, (abs_of_nonneg zero_le_one : abs (1 : A) = 1)],
|
|
|
|
|
rewrite [*pow_succ, abs_mul, ih]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end decidable_linear_ordered_comm_ring
|
|
|
|
|
|
2015-08-27 17:29:19 +00:00
|
|
|
|
section field
|
|
|
|
|
variable [s : field A]
|
|
|
|
|
include s
|
|
|
|
|
|
|
|
|
|
theorem field.div_pow (a : A) {b : A} {n : ℕ} (bnz : b ≠ 0) : (a / b)^n = a^n / b^n :=
|
|
|
|
|
begin
|
|
|
|
|
induction n with n ih,
|
|
|
|
|
rewrite [*pow_zero, div_one],
|
|
|
|
|
have bnnz : b^n ≠ 0, from division_ring.pow_ne_zero_of_ne_zero bnz,
|
|
|
|
|
rewrite [*pow_succ, ih, !field.div_mul_div bnz bnnz]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end field
|
|
|
|
|
|
2015-08-17 03:23:03 +00:00
|
|
|
|
section discrete_field
|
|
|
|
|
variable [s : discrete_field A]
|
|
|
|
|
include s
|
|
|
|
|
|
2015-08-27 17:29:19 +00:00
|
|
|
|
theorem div_pow (a : A) {b : A} {n : ℕ} : (a / b)^n = a^n / b^n :=
|
2015-08-17 03:23:03 +00:00
|
|
|
|
begin
|
|
|
|
|
induction n with n ih,
|
|
|
|
|
rewrite [*pow_zero, div_one],
|
2015-08-27 17:29:19 +00:00
|
|
|
|
rewrite [*pow_succ, ih, div_mul_div]
|
2015-08-17 03:23:03 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end discrete_field
|