File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,6 @@ Local Open Scope list_scope.
66
66
(* TODO: move to global settings *)
67
67
Local Set Keyed Unification.
68
68
69
- Local Lemma land_ones_eq_of_bounded v n
70
- (H : (0 <= v < 2 ^ (Z.of_N n))%Z)
71
- : Z.land v (Z.ones (Z.of_N n)) = v.
72
- Proof .
73
- rewrite Z.land_ones by lia.
74
- rewrite Z.mod_small by lia.
75
- reflexivity.
76
- Qed .
77
-
78
69
Import Map.Interface Map.Separation. (* for coercions *)
79
70
Require Import bedrock2.Array.
80
71
Require Import bedrock2.ZnWords.
@@ -304,7 +295,7 @@ Proof.
304
295
cbv [R_regs R_reg Tuple.fieldwise Tuple.fieldwise' eval_idx_Z] in *; cbn [fst snd].
305
296
repeat apply conj; intros; inversion_option; subst; try assumption.
306
297
all: change 64%Z with (Z.of_N 64).
307
- all: rewrite land_ones_eq_of_bounded; [ reflexivity | ].
298
+ all: rewrite Z. land_ones_eq_of_bounded; [ reflexivity | ].
308
299
all: assumption.
309
300
Qed .
310
301
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ Module Z.
67
67
intros. rewrite Z.sub_1_r, <- Z.ones_equiv.
68
68
apply Z.land_ones; auto with zarith.
69
69
Qed .
70
-
70
+
71
71
Lemma land_pow2_testbit a b :
72
72
a &' 2^b = if Z.testbit a b then 2^b else 0.
73
73
Proof .
@@ -96,6 +96,15 @@ Module Z.
96
96
Proof .
97
97
destruct (Z.ltb_spec b 0).
98
98
- now rewrite Pow.Z.base_pow_neg, Z.land_0_r.
99
- - rewrite land_pow2_testbit, Z.div2_bits, Testbit.Z.bits_above_pow2;
99
+ - rewrite land_pow2_testbit, Z.div2_bits, Testbit.Z.bits_above_pow2;
100
100
try (replace (Z.succ b) with (b + 1); nia). Qed .
101
+
102
+ Lemma land_ones_eq_of_bounded v n
103
+ (H : (0 <= v < 2 ^ (Z.of_N n))%Z)
104
+ : Z.land v (Z.ones (Z.of_N n)) = v.
105
+ Proof .
106
+ rewrite Z.land_ones by lia.
107
+ rewrite Z.mod_small by lia.
108
+ reflexivity.
109
+ Qed .
101
110
End Z.
You can’t perform that action at this time.
0 commit comments