aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/unification.ml
diff options
context:
space:
mode:
authorGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2018-03-01 15:19:52 +0100
committerGravatar Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>2018-03-09 16:30:11 +0100
commitd640b676282285d52ac19038d693080e64eb5ea7 (patch)
tree6c09e0963369997ff5e9c55490ff98a04331d1cd /pretyping/unification.ml
parentee7f5486fff86c453767997f97eda381983c4bbc (diff)
Statically enforce that ULub is only between levels.
Diffstat (limited to 'pretyping/unification.ml')
-rw-r--r--pretyping/unification.ml18
1 files changed, 11 insertions, 7 deletions
diff --git a/pretyping/unification.ml b/pretyping/unification.ml
index 1cd8d3940..76bd88cc0 100644
--- a/pretyping/unification.ml
+++ b/pretyping/unification.ml
@@ -561,12 +561,16 @@ let is_rigid_head sigma flags t =
| Lambda (_, _, _) | LetIn (_, _, _, _) | App (_, _) | Case (_, _, _, _)
| Proj (_, _) -> false (* Why aren't Prod, Sort rigid heads ? *)
-let force_eqs c =
- Universes.Constraints.fold
- (fun ((l,d,r) as c) acc ->
- let c' = if d == Universes.ULub then (l,Universes.UEq,r) else c in
- Universes.Constraints.add c' acc)
- c Universes.Constraints.empty
+let force_eqs c =
+ let open Universes in
+ Constraints.fold
+ (fun c acc ->
+ let c' = match c with
+ | ULub (l, r) -> UEq (Univ.Universe.make l,Univ.Universe.make r)
+ | ULe _ | UEq _ -> c
+ in
+ Constraints.add c' acc)
+ c Constraints.empty
let constr_cmp pb env sigma flags t u =
let cstrs =
@@ -579,7 +583,7 @@ let constr_cmp pb env sigma flags t u =
with Univ.UniverseInconsistency _ -> sigma, false
| Evd.UniversesDiffer ->
if is_rigid_head sigma flags t then
- try Evd.add_universe_constraints sigma (force_eqs cstrs), true
+ try Evd.add_universe_constraints sigma (force_eqs cstrs), true
with Univ.UniverseInconsistency _ -> sigma, false
else sigma, false
end