aboutsummaryrefslogtreecommitdiffstats
path: root/src/trace/coqTerms.ml
diff options
context:
space:
mode:
authorChantal Keller <Chantal.Keller@lri.fr>2021-04-21 10:01:24 +0200
committerChantal Keller <Chantal.Keller@lri.fr>2021-04-21 10:01:24 +0200
commit5038242bff601d79d2fad04795fb7f1b77738291 (patch)
treee001627574dc8df5b79b3f45d0002f8368826962 /src/trace/coqTerms.ml
parent745928a8f6200525d6ac5f6ebb0e395410fd5c36 (diff)
parent13d2c8be2ffb84bc8d40064b223562832e5a5a7e (diff)
downloadsmtcoq-5038242bff601d79d2fad04795fb7f1b77738291.tar.gz
smtcoq-5038242bff601d79d2fad04795fb7f1b77738291.zip
Merge branch 'coq-8.10' of github.com:smtcoq/smtcoq into coq-8.11
Diffstat (limited to 'src/trace/coqTerms.ml')
-rw-r--r--src/trace/coqTerms.ml25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/trace/coqTerms.ml b/src/trace/coqTerms.ml
index 9af2b8c..51e99ae 100644
--- a/src/trace/coqTerms.ml
+++ b/src/trace/coqTerms.ml
@@ -354,7 +354,6 @@ let rec mk_bv_list = function
(* Reification *)
-
let mk_bool b =
let c, args = Structures.decompose_app b in
if Structures.eq_constr c (Lazy.force ctrue) then true
@@ -434,3 +433,27 @@ let mk_bvsize n =
else assert false
| _ -> assert false
else mk_N n
+
+(** Switches between constr and OCaml *)
+(* Transform a option constr into a constr option *)
+let option_of_constr_option co =
+ let c, args = Structures.decompose_app co in
+ if c = Lazy.force cSome then
+ match args with
+ | [_;c] -> Some c
+ | _ -> assert false
+ else
+ None
+
+(* Transform a tuple of constr into a (reversed) list of constr *)
+let list_of_constr_tuple =
+ let rec list_of_constr_tuple acc t =
+ let c, args = Structures.decompose_app t in
+ if c = Lazy.force cpair then
+ match args with
+ | [_;_;t;l] -> list_of_constr_tuple (l::acc) t
+ | _ -> assert false
+ else
+ t::acc
+ in
+ list_of_constr_tuple []