Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
Properties of the power function
Require Import Bool ZAxioms ZMulOrder ZParity ZSgnAbs NZPow. Module Type ZPowProp (Import A : ZAxiomsSig') (Import B : ZMulOrderProp A) (Import C : ZParityProp A B) (Import D : ZSgnAbsProp A B). Include NZPowProp A A B.
A particular case of pow_add_r, with no precondition
a, b:ta ^ (2 * b) == a ^ b * a ^ ba, b:ta ^ (2 * b) == a ^ b * a ^ ba, b:ta ^ (S 1 * b) == a ^ b * a ^ ba, b:ta ^ (b + b) == a ^ b * a ^ ba, b:tH:0 <= ba ^ (b + b) == a ^ b * a ^ ba, b:tH:b < 0a ^ (b + b) == a ^ b * a ^ bnow rewrite pow_add_r.a, b:tH:0 <= ba ^ (b + b) == a ^ b * a ^ ba, b:tH:b < 0a ^ (b + b) == a ^ b * a ^ ba, b:tH:b < 00 == 0 * 0a, b:tH:b < 0b < 0a, b:tH:b < 0b + b < 0a, b:tH:b < 0b < 0a, b:tH:b < 0b + b < 0now apply add_neg_neg. Qed.a, b:tH:b < 0b + b < 0
Parity of power
forall a b : t, 0 < b -> even (a ^ b) = even aforall a b : t, 0 < b -> even (a ^ b) = even aa, b:tHb:0 < beven (a ^ b) = even aa, b:tHb:0 < bProper (eq ==> iff) (fun b0 : t => even (a ^ b0) = even a)a, b:tHb:0 < beven (a ^ S 0) = even aa, b:tHb:0 < bforall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even aa, b:tHb:0 < beven (a ^ S 0) = even aa, b:tHb:0 < bforall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even aa, b:tHb:0 < bforall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even aa:tforall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even aa, b:tHb:0 < bIH:even (a ^ b) = even aeven (a ^ S b) = even aa, b:tHb:0 < bIH:even (a ^ b) = even aeven (a * a ^ b) = even anow destruct (even a). Qed.a, b:tHb:0 < bIH:even (a ^ b) = even aeven a || even a = even aforall a b : t, 0 < b -> odd (a ^ b) = odd aforall a b : t, 0 < b -> odd (a ^ b) = odd anow rewrite <- !negb_even, even_pow. Qed.a, b:tH:0 < bodd (a ^ b) = odd a
Properties of power of negative numbers
forall a b : t, Even b -> (- a) ^ b == a ^ bforall a b : t, Even b -> (- a) ^ b == a ^ ba, b, c:tH:b == 2 * c(- a) ^ b == a ^ ba, b, c:tH:b == 2 * c(- a) ^ (2 * c) == a ^ (2 * c)a, b, c:tH:b == 2 * cH0:0 <= c(- a) ^ (2 * c) == a ^ (2 * c)a, b, c:tH:b == 2 * cH0:c < 0(- a) ^ (2 * c) == a ^ (2 * c)a, b, c:tH:b == 2 * cH0:0 <= c((- a) ^ 2) ^ c == (a ^ 2) ^ ca, b, c:tH:b == 2 * cH0:c < 0(- a) ^ (2 * c) == a ^ (2 * c)a, b, c:tH:b == 2 * cH0:0 <= c(- a * - a) ^ c == (a * a) ^ ca, b, c:tH:b == 2 * cH0:c < 0(- a) ^ (2 * c) == a ^ (2 * c)a, b, c:tH:b == 2 * cH0:c < 0(- a) ^ (2 * c) == a ^ (2 * c)now rewrite !pow_neg_r. Qed.a, b, c:tH:b == 2 * cH0:c < 0H1:2 * c < 0(- a) ^ (2 * c) == a ^ (2 * c)forall a b : t, Odd b -> (- a) ^ b == - a ^ bforall a b : t, Odd b -> (- a) ^ b == - a ^ ba, b, c:tH:b == 2 * c + 1(- a) ^ b == - a ^ ba, b, c:tH:b == 2 * c + 1(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1LE:0 <= c(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1GT:c < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1LE:0 <= cH0:0 <= 2 * c(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1GT:c < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1LE:0 <= cH0:0 <= 2 * c- a * (- a) ^ (2 * c) == - (a * a ^ (2 * c))a, b, c:tH:b == 2 * c + 1GT:c < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1LE:0 <= cH0:0 <= 2 * c- a * a ^ (2 * c) == - (a * a ^ (2 * c))a, b, c:tH:b == 2 * c + 1GT:c < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1GT:c < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1GT:2 * c + 1 < 2 * 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)a, b, c:tH:b == 2 * c + 1GT:2 * c + 1 < 0(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)now rewrite opp_0. Qed.a, b, c:tH:b == 2 * c + 1GT:2 * c + 1 < 00 == - 0forall a b : t, Even b -> a ^ b == abs a ^ bforall a b : t, Even b -> a ^ b == abs a ^ ba, b:tH:Even ba ^ b == abs a ^ ba, b:tH:Even bEQ:abs a == aa ^ b == a ^ ba, b:tH:Even bEQ:abs a == - aa ^ b == (- a) ^ ba, b:tH:Even bEQ:abs a == - aa ^ b == (- a) ^ bnow apply pow_opp_even. Qed.a, b:tH:Even bEQ:abs a == - a(- a) ^ b == a ^ bforall a b : t, Even b -> 0 <= a ^ bforall a b : t, Even b -> 0 <= a ^ ba, b:tH:Even b0 <= a ^ bapply pow_nonneg, abs_nonneg. Qed.a, b:tH:Even b0 <= abs a ^ bforall a b : t, Odd b -> a ^ b == sgn a * abs a ^ bforall a b : t, Odd b -> a ^ b == sgn a * abs a ^ ba, b:tH:Odd ba ^ b == sgn a * abs a ^ ba, b:tH:Odd bLT:0 < aEQ:sgn a == 1a ^ b == 1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0a ^ b == 0 * abs a ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bLT:0 < aEQ:sgn a == 1a ^ b == abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0a ^ b == 0 * abs a ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0a ^ b == 0 * abs a ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 00 ^ b == 0 * abs 0 ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 00 ^ b == 0a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:0 <= b0 ^ b == 0a, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:b < 00 ^ b == 0a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:0 <= b0 < ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:b < 00 ^ b == 0a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:0 <= bH1:b ~= 00 < ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:b < 00 ^ b == 0a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bEQ':0 == aEQ:sgn a == 0H0:b < 00 ^ b == 0a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * abs a ^ ba, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * (- a) ^ bnow rewrite mul_opp_opp, mul_1_l. Qed.a, b:tH:Odd bLT:a < 0EQ:sgn a == -1a ^ b == -1 * - a ^ bforall a b : t, 0 <= b -> Odd b -> sgn (a ^ b) == sgn aforall a b : t, 0 <= b -> Odd b -> sgn (a ^ b) == sgn aa, b:tHb:0 <= bH:Odd bsgn (a ^ b) == sgn aa, b:tHb:0 <= bH:Odd bLT:0 < aEQ:sgn a == 1sgn (a ^ b) == 1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0sgn (a ^ b) == 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bLT:0 < aEQ:sgn a == 10 < a ^ ba, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0sgn (a ^ b) == 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0sgn (a ^ b) == 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0sgn (0 ^ b) == 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0sgn 0 == 0a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 00 < ba, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 00 < ba, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bEQ':0 == aEQ:sgn a == 0H0:b ~= 00 < ba, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1sgn (a ^ b) == -1a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1a ^ b < 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1(- - a) ^ b < 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -1- (- a) ^ b < 0a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -10 < (- a) ^ bnow apply opp_pos_neg. Qed.a, b:tHb:0 <= bH:Odd bLT:a < 0EQ:sgn a == -10 < - aforall a b : t, abs (a ^ b) == abs a ^ bforall a b : t, abs (a ^ b) == abs a ^ ba, b:tabs (a ^ b) == abs a ^ ba, b:tH:Even babs (a ^ b) == abs a ^ ba, b:tH:Odd babs (a ^ b) == abs a ^ ba, b:tH:Even babs (abs a ^ b) == abs a ^ ba, b:tH:Odd babs (a ^ b) == abs a ^ ba, b:tH:Odd babs (a ^ b) == abs a ^ ba, b:tH:Odd babs (sgn a * abs a ^ b) == abs a ^ ba, b:tH:Odd babs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 < aabs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == aabs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 < aabs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == aabs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == aabs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == a0 == 0 ^ ba, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == a0 ^ b == 0a, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == ab ~= 0a, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:0 == aHb:b == 0Falsea, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd 0Ha:0 == aHb:b == 0Falsea, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd 0Ha:0 == aHb:b == 0Even 0a, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ ba, b:tH:Odd bHa:a < 0abs (sgn a) * abs (abs a ^ b) == abs a ^ bapply abs_eq, pow_nonneg, abs_nonneg. Qed. End ZPowProp.a, b:tH:Odd bHa:a < 0abs (abs a ^ b) == abs a ^ b