summaryrefslogtreecommitdiff
path: root/lib/coq/Sail2_operators_mwords.v
diff options
context:
space:
mode:
authorBrian Campbell2018-11-21 13:58:26 +0000
committerBrian Campbell2018-11-21 16:30:58 +0000
commit9b68baa58c1c6a3fc28df961624c522cca74cf8c (patch)
tree00707a8e6feed72c5b42ad3f70e7ff9a15854436 /lib/coq/Sail2_operators_mwords.v
parent05c68ff053485e9d5089969303e73045fb6cab6c (diff)
Coq: add equality for records and polymorphic vectors
Diffstat (limited to 'lib/coq/Sail2_operators_mwords.v')
-rw-r--r--lib/coq/Sail2_operators_mwords.v20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/coq/Sail2_operators_mwords.v b/lib/coq/Sail2_operators_mwords.v
index b5bcfe5f..e37e9d26 100644
--- a/lib/coq/Sail2_operators_mwords.v
+++ b/lib/coq/Sail2_operators_mwords.v
@@ -9,12 +9,6 @@ Require Import ZArith.
Require Import Omega.
Require Import Eqdep_dec.
-Module Z_eq_dec.
-Definition U := Z.
-Definition eq_dec := Z.eq_dec.
-End Z_eq_dec.
-Module ZEqdep := DecidableEqDep (Z_eq_dec).
-
Fixpoint cast_positive (T : positive -> Type) (p q : positive) : T p -> p = q -> T q.
refine (
match p, q with
@@ -444,6 +438,20 @@ Definition sgteq_vec := sgteq_bv.
*)
+Definition eq_vec_dec {n} : forall (x y : mword n), {x = y} + {x <> y}.
+refine (match n with
+| Z0 => _
+| Zpos m => _
+| Zneg m => _
+end).
+* simpl. apply Word.weq.
+* simpl. apply Word.weq.
+* simpl. destruct x.
+Defined.
+
+Instance Decidable_eq_mword {n} : forall (x y : mword n), Decidable (x = y) :=
+ Decidable_eq_from_dec eq_vec_dec.
+
Program Fixpoint reverse_endianness_word {n} (bits : word n) : word n :=
match n with
| S (S (S (S (S (S (S (S m))))))) =>