aboutsummaryrefslogtreecommitdiff
path: root/src/Util/WordUtil.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-10-27 19:13:36 -0400
committerGravatar Jason Gross <jgross@mit.edu>2016-10-27 19:13:36 -0400
commitcf7c7901d5c9ab3623537087cd98e204d703ac27 (patch)
tree6b9bf0312c84ee1a042a9de9f1ffc887e922d16c /src/Util/WordUtil.v
parent00965588b4e14e34cd0f864fb32a780ad8bae89d (diff)
Add beginnings of various interpretations of expression trees
Diffstat (limited to 'src/Util/WordUtil.v')
-rw-r--r--src/Util/WordUtil.v8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Util/WordUtil.v b/src/Util/WordUtil.v
index 2a3c48fcf..de5cd0847 100644
--- a/src/Util/WordUtil.v
+++ b/src/Util/WordUtil.v
@@ -10,6 +10,11 @@ Require Import Coq.micromega.Psatz.
Local Open Scope nat_scope.
+Create HintDb pull_wordToN discriminated.
+Create HintDb push_wordToN discriminated.
+Hint Extern 1 => autorewrite with pull_wordToN in * : pull_wordToN.
+Hint Extern 1 => autorewrite with push_wordToN in * : push_wordToN.
+
Lemma pow2_id : forall n, pow2 n = 2 ^ n.
Proof.
induction n; intros; simpl; auto.
@@ -42,6 +47,8 @@ Proof.
apply natToWord_wordToNat.
Qed.
+Hint Rewrite NToWord_wordToN : pull_wordToN.
+
Lemma bound_check_nat_N : forall x n, (Z.to_nat x < 2 ^ n)%nat -> (Z.to_N x < Npow2 n)%N.
Proof.
intros x n bound_nat.
@@ -92,6 +99,7 @@ Proof. destruct pf; rewrite cast_word_refl; trivial. Qed.
Lemma wordToN_cast_word {n} (w:word n) m pf :
wordToN (@cast_word n m pf w) = wordToN w.
Proof. destruct pf; rewrite cast_word_refl; trivial. Qed.
+Hint Rewrite @wordToN_cast_word : push_wordToN.
Import NPeano Nat.
Local Infix "++" := combine.