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:t

a ^ (2 * b) == a ^ b * a ^ b
a, b:t

a ^ (2 * b) == a ^ b * a ^ b
a, b:t

a ^ (S 1 * b) == a ^ b * a ^ b
a, b:t

a ^ (b + b) == a ^ b * a ^ b
a, b:t
H:0 <= b

a ^ (b + b) == a ^ b * a ^ b
a, b:t
H:b < 0
a ^ (b + b) == a ^ b * a ^ b
a, b:t
H:0 <= b

a ^ (b + b) == a ^ b * a ^ b
now rewrite pow_add_r.
a, b:t
H:b < 0

a ^ (b + b) == a ^ b * a ^ b
a, b:t
H:b < 0

0 == 0 * 0
a, b:t
H:b < 0
b < 0
a, b:t
H:b < 0
b + b < 0
a, b:t
H:b < 0

b < 0
a, b:t
H:b < 0
b + b < 0
a, b:t
H:b < 0

b + b < 0
now apply add_neg_neg. Qed.
Parity of power

forall a b : t, 0 < b -> even (a ^ b) = even a

forall a b : t, 0 < b -> even (a ^ b) = even a
a, b:t
Hb:0 < b

even (a ^ b) = even a
a, b:t
Hb:0 < b

Proper (eq ==> iff) (fun b0 : t => even (a ^ b0) = even a)
a, b:t
Hb:0 < b
even (a ^ S 0) = even a
a, b:t
Hb:0 < b
forall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even a
a, b:t
Hb:0 < b

even (a ^ S 0) = even a
a, b:t
Hb:0 < b
forall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even a
a, b:t
Hb:0 < b

forall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even a
a:t

forall m : t, 0 < m -> even (a ^ m) = even a -> even (a ^ S m) = even a
a, b:t
Hb:0 < b
IH:even (a ^ b) = even a

even (a ^ S b) = even a
a, b:t
Hb:0 < b
IH:even (a ^ b) = even a

even (a * a ^ b) = even a
a, b:t
Hb:0 < b
IH:even (a ^ b) = even a

even a || even a = even a
now destruct (even a). Qed.

forall a b : t, 0 < b -> odd (a ^ b) = odd a

forall a b : t, 0 < b -> odd (a ^ b) = odd a
a, b:t
H:0 < b

odd (a ^ b) = odd a
now rewrite <- !negb_even, even_pow. Qed.
Properties of power of negative numbers

forall a b : t, Even b -> (- a) ^ b == a ^ b

forall a b : t, Even b -> (- a) ^ b == a ^ b
a, b, c:t
H:b == 2 * c

(- a) ^ b == a ^ b
a, b, c:t
H:b == 2 * c

(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:0 <= c

(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:c < 0
(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:0 <= c

((- a) ^ 2) ^ c == (a ^ 2) ^ c
a, b, c:t
H:b == 2 * c
H0:c < 0
(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:0 <= c

(- a * - a) ^ c == (a * a) ^ c
a, b, c:t
H:b == 2 * c
H0:c < 0
(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:c < 0

(- a) ^ (2 * c) == a ^ (2 * c)
a, b, c:t
H:b == 2 * c
H0:c < 0
H1:2 * c < 0

(- a) ^ (2 * c) == a ^ (2 * c)
now rewrite !pow_neg_r. Qed.

forall a b : t, Odd b -> (- a) ^ b == - a ^ b

forall a b : t, Odd b -> (- a) ^ b == - a ^ b
a, b, c:t
H:b == 2 * c + 1

(- a) ^ b == - a ^ b
a, b, c:t
H:b == 2 * c + 1

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
LE:0 <= c

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:c < 0
(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
LE:0 <= c
H0:0 <= 2 * c

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:c < 0
(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
LE:0 <= c
H0:0 <= 2 * c

- a * (- a) ^ (2 * c) == - (a * a ^ (2 * c))
a, b, c:t
H:b == 2 * c + 1
GT:c < 0
(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
LE:0 <= c
H0:0 <= 2 * c

- a * a ^ (2 * c) == - (a * a ^ (2 * c))
a, b, c:t
H:b == 2 * c + 1
GT:c < 0
(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:c < 0

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:2 * c + 1 < 2 * 0

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:2 * c + 1 < 0

(- a) ^ (2 * c + 1) == - a ^ (2 * c + 1)
a, b, c:t
H:b == 2 * c + 1
GT:2 * c + 1 < 0

0 == - 0
now rewrite opp_0. Qed.

forall a b : t, Even b -> a ^ b == abs a ^ b

forall a b : t, Even b -> a ^ b == abs a ^ b
a, b:t
H:Even b

a ^ b == abs a ^ b
a, b:t
H:Even b
EQ:abs a == a

a ^ b == a ^ b
a, b:t
H:Even b
EQ:abs a == - a
a ^ b == (- a) ^ b
a, b:t
H:Even b
EQ:abs a == - a

a ^ b == (- a) ^ b
a, b:t
H:Even b
EQ:abs a == - a

(- a) ^ b == a ^ b
now apply pow_opp_even. Qed.

forall a b : t, Even b -> 0 <= a ^ b

forall a b : t, Even b -> 0 <= a ^ b
a, b:t
H:Even b

0 <= a ^ b
a, b:t
H:Even b

0 <= abs a ^ b
apply pow_nonneg, abs_nonneg. Qed.

forall a b : t, Odd b -> a ^ b == sgn a * abs a ^ b

forall a b : t, Odd b -> a ^ b == sgn a * abs a ^ b
a, b:t
H:Odd b

a ^ b == sgn a * abs a ^ b
a, b:t
H:Odd b
LT:0 < a
EQ:sgn a == 1

a ^ b == 1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
a ^ b == 0 * abs a ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
LT:0 < a
EQ:sgn a == 1

a ^ b == abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
a ^ b == 0 * abs a ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0

a ^ b == 0 * abs a ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0

0 ^ b == 0 * abs 0 ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0

0 ^ b == 0
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:0 <= b

0 ^ b == 0
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:b < 0
0 ^ b == 0
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:0 <= b

0 < b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:b < 0
0 ^ b == 0
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:0 <= b
H1:b ~= 0

0 < b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:b < 0
0 ^ b == 0
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:b < 0

0 ^ b == 0
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1
a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1

a ^ b == -1 * abs a ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1

a ^ b == -1 * (- a) ^ b
a, b:t
H:Odd b
LT:a < 0
EQ:sgn a == -1

a ^ b == -1 * - a ^ b
now rewrite mul_opp_opp, mul_1_l. Qed.

forall a b : t, 0 <= b -> Odd b -> sgn (a ^ b) == sgn a

forall a b : t, 0 <= b -> Odd b -> sgn (a ^ b) == sgn a
a, b:t
Hb:0 <= b
H:Odd b

sgn (a ^ b) == sgn a
a, b:t
Hb:0 <= b
H:Odd b
LT:0 < a
EQ:sgn a == 1

sgn (a ^ b) == 1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0
sgn (a ^ b) == 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
LT:0 < a
EQ:sgn a == 1

0 < a ^ b
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0
sgn (a ^ b) == 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0

sgn (a ^ b) == 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0

sgn (0 ^ b) == 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0

sgn 0 == 0
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0
0 < b
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0

0 < b
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
EQ':0 == a
EQ:sgn a == 0
H0:b ~= 0

0 < b
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1
sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

sgn (a ^ b) == -1
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

a ^ b < 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

(- - a) ^ b < 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

- (- a) ^ b < 0
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

0 < (- a) ^ b
a, b:t
Hb:0 <= b
H:Odd b
LT:a < 0
EQ:sgn a == -1

0 < - a
now apply opp_pos_neg. Qed.

forall a b : t, abs (a ^ b) == abs a ^ b

forall a b : t, abs (a ^ b) == abs a ^ b
a, b:t

abs (a ^ b) == abs a ^ b
a, b:t
H:Even b

abs (a ^ b) == abs a ^ b
a, b:t
H:Odd b
abs (a ^ b) == abs a ^ b
a, b:t
H:Even b

abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
abs (a ^ b) == abs a ^ b
a, b:t
H:Odd b

abs (a ^ b) == abs a ^ b
a, b:t
H:Odd b

abs (sgn a * abs a ^ b) == abs a ^ b
a, b:t
H:Odd b

abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 < a

abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 < a

abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a

abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a

0 == 0 ^ b
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a

0 ^ b == 0
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a

b ~= 0
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:0 == a
Hb:b == 0

False
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd 0
Ha:0 == a
Hb:b == 0

False
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd 0
Ha:0 == a
Hb:b == 0

Even 0
a, b:t
H:Odd b
Ha:a < 0
abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:a < 0

abs (sgn a) * abs (abs a ^ b) == abs a ^ b
a, b:t
H:Odd b
Ha:a < 0

abs (abs a ^ b) == abs a ^ b
apply abs_eq, pow_nonneg, abs_nonneg. Qed. End ZPowProp.