(* -*- coding: utf-8 -*- *)
(************************************************************************)
(*         *   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)         *)
(************************************************************************)
(** Binary Integers (Pierre Crégut, CNET, Lannion, France) *)
Require Export Arith_base.
Local Open Scope Z_scope.
(** Conversions between integers and natural numbers  Seven sections: - chains of conversions (combining two conversions) - module N2Z : from N to Z - module Z2N : from Z to N (negative numbers rounded to 0) - module Zabs2N : from Z to N (via the absolute value) - module Nat2Z : from nat to Z - module Z2Nat : from Z to nat (negative numbers rounded to 0) - module Zabs2Nat : from Z to nat (via the absolute value) *)
(** * Chains of conversions *)
(** When combining successive conversions, we have the following commutative diagram: << ---> Nat ---- |      ^      | |      |      v Pos ---------> Z |      |      ^ |      v      | ----> N ----- >> *)

Lemma positive_nat_Z p : Z.of_nat (Pos.to_nat p) = Zpos p.