summaryrefslogtreecommitdiff
path: root/lib/coq
diff options
context:
space:
mode:
authorBrian Campbell2018-06-25 15:44:45 +0100
committerBrian Campbell2018-06-25 18:38:20 +0100
commit1c1a121ae0434e5dc6cb05bbafa6e8c2fa3cbf35 (patch)
tree34ad3a1c079371df9908fbec6170bdb268106e65 /lib/coq
parent9ed70b51d3e02acb3f11b9f2a6c6a0c9931ba554 (diff)
Coq: automatic cast introduction
Diffstat (limited to 'lib/coq')
-rw-r--r--lib/coq/Sail2_operators_mwords.v3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/coq/Sail2_operators_mwords.v b/lib/coq/Sail2_operators_mwords.v
index 25a643e7..ee98c94e 100644
--- a/lib/coq/Sail2_operators_mwords.v
+++ b/lib/coq/Sail2_operators_mwords.v
@@ -27,6 +27,9 @@ Qed.
Definition autocast {m n} (x : mword m) `{H:ArithFact (m = n)} : mword n :=
cast_mword x (use_ArithFact H).
+Definition autocast_m {rv e m n} (x : monad rv (mword m) e) `{H:ArithFact (m = n)} : monad rv (mword n) e :=
+ x >>= fun x => returnm (cast_mword x (use_ArithFact H)).
+
Definition cast_word {m n} (x : Word.word m) (eq : m = n) : Word.word n.
rewrite <- eq.
exact x.