aboutsummaryrefslogtreecommitdiff
path: root/engine/eConstr.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-10-17 15:29:47 +0200
committerPierre-Marie Pédrot2018-10-17 15:29:47 +0200
commit15998894ff76b1fa9354085ea0bddae4f8f23ddf (patch)
tree254cc3a53b6aa344f49a10cba32e14acf97d2905 /engine/eConstr.ml
parent063cf49f40511730c8c60c45332e92823ce4c78f (diff)
parent6aa0aa37e19457a8c0c3ad36f7bbead058442344 (diff)
Merge PR #8694: Various cleanups of universe apis
Diffstat (limited to 'engine/eConstr.ml')
-rw-r--r--engine/eConstr.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/engine/eConstr.ml b/engine/eConstr.ml
index 8ab3ce821e..3385b78958 100644
--- a/engine/eConstr.ml
+++ b/engine/eConstr.ml
@@ -74,6 +74,12 @@ let mkCoFix f = of_kind (CoFix f)
let mkProj (p, c) = of_kind (Proj (p, c))
let mkArrow t1 t2 = of_kind (Prod (Anonymous, t1, t2))
+let mkRef (gr,u) = let open GlobRef in match gr with
+ | ConstRef c -> mkConstU (c,u)
+ | IndRef ind -> mkIndU (ind,u)
+ | ConstructRef c -> mkConstructU (c,u)
+ | VarRef x -> mkVar x
+
let applist (f, arg) = mkApp (f, Array.of_list arg)
let isRel sigma c = match kind sigma c with Rel _ -> true | _ -> false
@@ -166,6 +172,13 @@ let destProj sigma c = match kind sigma c with
| Proj (p, c) -> (p, c)
| _ -> raise DestKO
+let destRef sigma c = let open GlobRef in match kind sigma c with
+ | Var x -> VarRef x, EInstance.empty
+ | Const (c,u) -> ConstRef c, u
+ | Ind (ind,u) -> IndRef ind, u
+ | Construct (c,u) -> ConstructRef c, u
+ | _ -> raise DestKO
+
let decompose_app sigma c =
match kind sigma c with
| App (f,cl) -> (f, Array.to_list cl)