aboutsummaryrefslogtreecommitdiff
path: root/src/Util/BoundedWord.v
diff options
context:
space:
mode:
Diffstat (limited to 'src/Util/BoundedWord.v')
-rw-r--r--src/Util/BoundedWord.v13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Util/BoundedWord.v b/src/Util/BoundedWord.v
new file mode 100644
index 000000000..cfd27a231
--- /dev/null
+++ b/src/Util/BoundedWord.v
@@ -0,0 +1,13 @@
+Require Import Coq.ZArith.ZArith.
+Require Import Crypto.Util.Tuple.
+Require Import Crypto.Util.ZRange.
+Require Import Crypto.Util.FixedWordSizes.
+
+Definition BoundedWord n (bitwidth : nat)
+ (bounds : tuple zrange n) : Type :=
+ { x : tuple (wordT bitwidth) n
+ | is_bounded_by (Some (Z.of_nat bitwidth)) bounds
+ (map wordToZ x)}.
+
+Definition BoundedWordToZ n w b (BW :BoundedWord n w b)
+ : tuple Z n := map wordToZ (proj1_sig BW).