aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorMatthieu Sozeau2020-04-29 13:59:23 +0200
committerMatthieu Sozeau2020-04-29 13:59:23 +0200
commit350865002815ab1e9fd8056b210c5ffcac115bfa (patch)
treec81421e629d93a8bb6c5e8768730f560ed540a2a /engine
parentcdc3614df9b9a37a43b14d69d2129f74634a3652 (diff)
parent7a881b39a264a8139aece0b5ece787a36b73104d (diff)
Merge PR #12158: [univ] API to demote global universes
Reviewed-by: mattam82
Diffstat (limited to 'engine')
-rw-r--r--engine/uState.ml8
-rw-r--r--engine/uState.mli5
2 files changed, 13 insertions, 0 deletions
diff --git a/engine/uState.ml b/engine/uState.ml
index abd5f2828f..00649ce042 100644
--- a/engine/uState.ml
+++ b/engine/uState.ml
@@ -527,6 +527,14 @@ let demote_seff_univs univs uctx =
let seff = LSet.union uctx.uctx_seff_univs univs in
{ uctx with uctx_seff_univs = seff }
+let demote_global_univs env uctx =
+ let env_ugraph = Environ.universes env in
+ let global_univs = UGraph.domain env_ugraph in
+ let global_constraints, _ = UGraph.constraints_of_universes env_ugraph in
+ let promoted_uctx =
+ ContextSet.(of_set global_univs |> add_constraints global_constraints) in
+ { uctx with uctx_local = ContextSet.diff uctx.uctx_local promoted_uctx }
+
let merge_seff uctx ctx' =
let levels = ContextSet.levels ctx' in
let declare g =
diff --git a/engine/uState.mli b/engine/uState.mli
index cd1c9a174e..6707826aae 100644
--- a/engine/uState.mli
+++ b/engine/uState.mli
@@ -110,6 +110,11 @@ val merge : ?loc:Loc.t -> sideff:bool -> rigid -> t -> Univ.ContextSet.t -> t
val merge_subst : t -> UnivSubst.universe_opt_subst -> t
val emit_side_effects : Safe_typing.private_constants -> t -> t
+val demote_global_univs : Environ.env -> t -> t
+(** Removes from the uctx_local part of the UState the universes and constraints
+ that are present in the universe graph in the input env (supposedly the
+ global ones *)
+
val demote_seff_univs : Univ.LSet.t -> t -> t
(** Mark the universes as not local any more, because they have been
globally declared by some side effect. You should be using