Module Import Private_BootStrap.
(** ** Operations and constants *)
(** ** Addition is commutative *)
(** ** Opposite distributes over addition *)
(** ** Opposite is injective *)
(** ** Addition is associative *)
Local Arguments add !x !y.
(** ** Opposite is inverse for addition *)
(** ** Multiplication and Opposite *)
(** ** Distributivity of multiplication over addition *)
End Private_BootStrap.
(** * Proofs of specifications *)
(** ** Specification of constants *)
(** ** Specification of addition *)
(** ** Specification of opposite *)
(** ** Specification of successor and predecessor *)
Local Arguments pos_sub : simpl nomatch.
(** ** Specification of subtraction *)
(** ** Specification of multiplication *)
(** ** Specification of comparisons and order *)
(** ** Specification of minimum and maximum *)
(** ** Induction principles based on successor / predecessor *)
(** We can now derive all properties of basic functions and orders, and use these properties for proving the specs of more advanced functions. *)
Include ZBasicProp <+ UsualMinMaxLogicalProperties <+ UsualMinMaxDecProperties.
Register eq_decidable as num.Z.eq_decidable.
Register le_decidable as num.Z.le_decidable.
Register lt_decidable as num.Z.lt_decidable.
(** ** Specification of absolute value *)
(** ** Specification of sign *)
(** ** Specification of power *)
(** For folding back a [pow_pos] into a [pow] *)
(** ** Specification of square *)
(** ** Specification of square root *)
(** ** Specification of logarithm *)
(** Specification of parity functions *)
(** ** Multiplication and Doubling *)
(** ** Correctness proofs for Trunc division *)
Definition mod_bound_pos a b (_:0<=a) := mod_pos_bound a b.
(** ** Correctness proofs for Floor division *)
(** ** Correctness proofs for gcd *)
(** ggcd and opp : an auxiliary result used in QArith *)
(** ** Extra properties about [testbit] *)
(** ** Proofs of specifications for bitwise operations *)
(** Correctness proofs about [Z.shiftr] and [Z.shiftl] *)
(** Correctness proofs for bitwise operations *)
(** Generic properties of advanced functions. *)
Include ZExtraProp.
(** In generic statements, the predicates [lt] and [le] have been favored, whereas [gt] and [ge] don't even exist in the abstract layers. The use of [gt] and [ge] is hence not recommended. We provide here the bare minimal results to related them with [lt] and [le]. *)
(** We provide a tactic converting from one style to the other. *)
Ltac swap_greater := rewrite ?gt_lt_iff in *; rewrite ?ge_le_iff in *.
(** Similarly, the boolean comparisons [ltb] and [leb] are favored over their dual [gtb] and [geb]. We prove here the equivalence and a few minimal results. *)
(** TODO : to add in Numbers ? *)
(** * Comparison and opposite *)
(** * Comparison and addition *)
(** * [testbit] in terms of comparison. *)

Lemma testbit_mod_pow2 a n i (H : 0 <= n)
: testbit (a mod 2 ^ n) i = ((i <? n) && testbit a i)%bool.