aboutsummaryrefslogtreecommitdiff
path: root/src/Util/ZUtil.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-11-08 10:54:37 -0500
committerGravatar Jason Gross <jgross@mit.edu>2016-11-08 10:54:37 -0500
commitf929cd20f82206be0bdf40b91c179dcb346408e1 (patch)
treee2fe0af52f9c1c9ea9a2349280708739fef9a609 /src/Util/ZUtil.v
parent7060f490f21c52d77b8985bf3388d9964d52a60f (diff)
Add log2_lt_pow2_alt
Diffstat (limited to 'src/Util/ZUtil.v')
-rw-r--r--src/Util/ZUtil.v9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Util/ZUtil.v b/src/Util/ZUtil.v
index 53179b44f..17e8d62bf 100644
--- a/src/Util/ZUtil.v
+++ b/src/Util/ZUtil.v
@@ -2128,6 +2128,15 @@ Module Z.
Qed.
Hint Resolve log2_ones_lt_nonneg : zarith.
+ Lemma log2_lt_pow2_alt a b : 0 < b -> a < 2^b <-> Z.log2 a < b.
+ Proof.
+ destruct (Z_lt_le_dec 0 a); auto using Z.log2_lt_pow2; [].
+ rewrite Z.log2_nonpos by omega.
+ split; auto with zarith; [].
+ intro; eapply le_lt_trans; [ eassumption | ].
+ auto with zarith.
+ Qed.
+
Lemma simplify_twice_sub_sub x y : 2 * x - (x - y) = x + y.
Proof. lia. Qed.
Hint Rewrite simplify_twice_sub_sub : zsimplify.