aboutsummaryrefslogtreecommitdiffhomepage
path: root/engine/eConstr.ml
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2017-12-05 12:56:11 +0100
committerGravatar Maxime Dénès <mail@maximedenes.fr>2017-12-05 12:56:11 +0100
commit2c5e81e3bc6ec17d253aeedd1b2bf4ccd3b81933 (patch)
tree1e8d3db28d8d19b575e9e555f6ce379960c842c1 /engine/eConstr.ml
parentd403b2200ef32afd1eb1087a1f0ef2e6b8bb93f6 (diff)
parent17b620f8bdf47a744d24513dcaef720d9160d443 (diff)
Merge PR #890: Global universe declarations
Diffstat (limited to 'engine/eConstr.ml')
-rw-r--r--engine/eConstr.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/engine/eConstr.ml b/engine/eConstr.ml
index afdceae06..ea098902a 100644
--- a/engine/eConstr.ml
+++ b/engine/eConstr.ml
@@ -645,6 +645,24 @@ let eq_constr_universes_proj env sigma m n =
let res = eq_constr' (unsafe_to_constr m) (unsafe_to_constr n) in
if res then Some !cstrs else None
+let universes_of_constr sigma c =
+ let open Univ in
+ let rec aux s c =
+ match kind sigma c with
+ | Const (_, u) | Ind (_, u) | Construct (_, u) ->
+ LSet.fold LSet.add (Instance.levels (EInstance.kind sigma u)) s
+ | Sort u ->
+ let sort = ESorts.kind sigma u in
+ if Sorts.is_small sort then s
+ else
+ let u = Sorts.univ_of_sort sort in
+ LSet.fold LSet.add (Universe.levels u) s
+ | Evar (k, args) ->
+ let concl = Evd.evar_concl (Evd.find sigma k) in
+ fold sigma aux (aux s (of_constr concl)) c
+ | _ -> fold sigma aux s c
+ in aux LSet.empty c
+
open Context
open Environ