(************************************************************************)
(*         *   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)         *)
(************************************************************************)
Require Export Zpow_def.
Local Open Scope Z_scope.
(** * Power functions over [Z] *)
(** Nota : this file is mostly deprecated. The definition of [Z.pow] and its usual properties are now provided by module [BinInt.Z]. Powers of 2 are also available there (see [Z.shiftl] and [Z.shiftr]). Only remain here: - [Zpower_nat] : a power function with a [nat] exponent - old-style powers of two, such as [two_p] - [Zdiv_rest] : a division + modulo when the divisor is a power of 2 *)
(** [Zpower_nat z n] is the n-th power of [z] when [n] is an unary integer (type [nat]) and [z] a signed integer (type [Z]) *)
Definition Zpower_nat (z:Z) := nat_rect _ 1 (fun _ => Z.mul z).
(** Conversions between powers of unary and binary integers *)
(** The function [(Z.pow_pos z)] is a morphism for [Pos.add : positive->positive->positive] and [Z.mul : Z->Z->Z] *)
Hint Immediate Zpower_nat_is_exp Zpower_pos_is_exp : zarith.
Hint Unfold Z.pow_pos Zpower_nat: zarith.

Theorem Zpower_exp x n m :
n >= 0 -> m >= 0 -> x ^ (n + m) = x ^ n * x ^ m.