diff options
| author | Matthieu Sozeau | 2014-04-29 16:04:11 +0200 |
|---|---|---|
| committer | Matthieu Sozeau | 2014-05-06 09:59:01 +0200 |
| commit | 84290ba5da2a6acb4bf95b197f7a7ce8b072a1d0 (patch) | |
| tree | 61c59f4149978e84ccf77b78ecb70ce3e3dd2188 /kernel | |
| parent | 902da7d2949464ff54dafc3fda1d44365270d2e1 (diff) | |
Find a more efficient fix for dealing with template universes:
eagerly solve l <= k constraints as k := l when k is a fresh variable coming
from a template type. This has the effect of fixing the variable at the first
instantiation of the parameters of template polymorphic inductive and avoiding
to generate useless <= constraints that need to be minimized afterwards.
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/univ.ml | 8 | ||||
| -rw-r--r-- | kernel/univ.mli | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/kernel/univ.ml b/kernel/univ.ml index d931626e4d..a9b5115886 100644 --- a/kernel/univ.ml +++ b/kernel/univ.ml @@ -755,6 +755,10 @@ struct let pr x = str(to_string x) + let is_level = function + | (v, 0) -> true + | _ -> false + let level = function | (v,0) -> Some v | _ -> None @@ -809,6 +813,10 @@ struct | Cons (l, n) when is_nil n -> Some l | _ -> None + let is_level l = match node l with + | Cons (l, n) when is_nil n -> Expr.is_level l + | _ -> false + let level l = match node l with | Cons (l, n) when is_nil n -> Expr.level l | _ -> None diff --git a/kernel/univ.mli b/kernel/univ.mli index 20ee554f18..cc5eedefb5 100644 --- a/kernel/univ.mli +++ b/kernel/univ.mli @@ -118,6 +118,9 @@ sig val pr : t -> Pp.std_ppcmds (** Pretty-printing *) + val is_level : t -> bool + (** Test if the universe is a level or an algebraic universe. *) + val level : t -> Level.t option (** Try to get a level out of a universe, returns [None] if it is an algebraic universe. *) |
