Standard Library | The Coq Proof Assistant

The Coq Proof Assistant

# Library Coq.Numbers.DecimalZ

# DecimalZ

Proofs that conversions between decimal numbers and Z are bijections.
Require Import Decimal DecimalFacts DecimalPos DecimalN ZArith.
Lemma of_to (z:Z) : Z.of_int (Z.to_int z) = z.
Lemma to_of (d:int) : Z.to_int (Z.of_int d) = norm d.
Some consequences
Lemma to_int_inj n n' : Z.to_int n = Z.to_int n' -> n = n'.
Lemma to_int_surj d : exists n, Z.to_int n = norm d.
Lemma of_int_norm d : Z.of_int (norm d) = Z.of_int d.
Lemma of_inj d d' :
Z.of_int d = Z.of_int d' -> norm d = norm d'.
Lemma of_iff d d' : Z.of_int d = Z.of_int d' <-> norm d = norm d'.
Various lemmas
Lemma of_uint_iter_D0 d n :
Z.of_uint (app d (Nat.iter n D0 Nil)) = Nat.iter n (Z.mul 10) (Z.of_uint d).
Lemma of_int_iter_D0 d n :
Z.of_int (app_int d (Nat.iter n D0 Nil)) = Nat.iter n (Z.mul 10) (Z.of_int d).
Lemma nztail_to_uint_pow10 n :
Decimal.nztail (Pos.to_uint (Nat.iter n (Pos.mul 10) 1%positive))
= (D1 Nil, n).