diff options
Diffstat (limited to 'theories/Numbers/Integer/SpecViaZ')
| -rw-r--r-- | theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v b/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v index 2c46be4c71..cf38adf3a0 100644 --- a/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v +++ b/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v @@ -411,14 +411,28 @@ Qed. (** Bitwise operations *) -Lemma testbit_spec : forall a n, 0<=n -> - exists l h, (0<=l /\ l<2^n) /\ - a == l + ((if testbit a n then 1 else 0) + 2*h)*2^n. -Proof. - intros a n. zify. intros H. - destruct (Ztestbit_spec [a] [n] H) as (l & h & Hl & EQ). - exists (of_Z l), (of_Z h). - destruct Ztestbit; zify; now split. +Program Instance testbit_wd : Proper (eq==>eq==>Logic.eq) testbit. + +Lemma testbit_odd_0 : forall a, testbit (2*a+1) 0 = true. +Proof. + intros. zify. apply Ztestbit_odd_0. +Qed. + +Lemma testbit_even_0 : forall a, testbit (2*a) 0 = false. +Proof. + intros. zify. apply Ztestbit_even_0. +Qed. + +Lemma testbit_odd_succ : forall a n, 0<=n -> + testbit (2*a+1) (succ n) = testbit a n. +Proof. + intros a n. zify. apply Ztestbit_odd_succ. +Qed. + +Lemma testbit_even_succ : forall a n, 0<=n -> + testbit (2*a) (succ n) = testbit a n. +Proof. + intros a n. zify. apply Ztestbit_even_succ. Qed. Lemma testbit_neg_r : forall a n, n<0 -> testbit a n = false. |
