Library Coq.ZArith.Znat
Binary Integers (Pierre Crégut, CNET, Lannion, France)
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 -----
Conversions between Z and N
Z.of_N is a bijection between N and non-negative Z,
with Z.to_N (or Z.abs_N) as reciprocal.
See Z2N.id below for the dual equation.
Z.of_N is hence injective
Z.of_N produce non-negative integers
Z.of_N, basic equations
Z.of_N and usual operations.
Z.to_N is a bijection between non-negative Z and N,
with Pos.of_N as reciprocal.
See N2Z.id above for the dual equation.
Z.to_N is hence injective for non-negative integers.
Z.to_N, basic equations
Z.to_N and operations
Results about Z.abs_N, converting absolute values of Z integers
to N.
Z.abs_N, basic equations
Z.abs_N and usual operations, with non-negative integers
Z.abs_N and usual operations, statements with Z.abs
Conversions between Z and nat
Z.of_nat, basic equations
Z.of_N produce non-negative integers
Z.of_nat is a bijection between nat and non-negative Z,
with Z.to_nat (or Z.abs_nat) as reciprocal.
See Z2Nat.id below for the dual equation.
Z.of_nat is hence injective
Z.of_nat and usual operations
Z.to_nat is a bijection between non-negative Z and nat,
with Pos.of_nat as reciprocal.
See nat2Z.id above for the dual equation.
Z.to_nat is hence injective for non-negative integers.
Z.to_nat, basic equations
Z.to_nat and operations
Results about Z.abs_nat, converting absolute values of Z integers
to nat.
Z.abs_nat, basic equations
Z.abs_nat and usual operations, with non-negative integers
Z.abs_nat and usual operations, statements with Z.abs
Compatibility
For these one, used in omega, a Definition is necessary
For the others, a Notation is fine