diff options
author | Matthieu Sozeau <mattam@mattam.org> | 2013-10-17 14:55:57 +0200 |
---|---|---|
committer | Matthieu Sozeau <mattam@mattam.org> | 2014-05-06 09:58:53 +0200 |
commit | 84cbc09bd1400f732a6c70e8a840e4c13d018478 (patch) | |
tree | f6b3417e653bea9de8f0d8f510ad19ccdbb4840e /library/global.ml | |
parent | 57bee17f928fc67a599d2116edb42a59eeb21477 (diff) |
Correct rebase on STM code. Thanks to E. Tassi for help on dealing with
latent universes. Now the universes in the type of a definition/lemma
are eagerly added to the environment so that later proofs can be checked
independently of the original (delegated) proof body.
- Fixed firstorder, ring to work correctly with universe polymorphism.
- Changed constr_of_global to raise an anomaly if side effects would be lost by
turning a polymorphic constant into a constr.
- Fix a non-termination issue in solve_evar_evar.
-
Diffstat (limited to 'library/global.ml')
-rw-r--r-- | library/global.ml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/library/global.ml b/library/global.ml index c56bc9e77..16b07db25 100644 --- a/library/global.ml +++ b/library/global.ml @@ -160,6 +160,30 @@ let type_of_global_unsafe r = let inst = Univ.UContext.instance mib.Declarations.mind_universes in Inductive.type_of_constructor (cstr,inst) specif +let type_of_global_in_context env r = + let open Declarations in + match r with + | VarRef id -> Environ.named_type id env, Univ.UContext.empty + | ConstRef c -> + let cb = Environ.lookup_constant c env in + let univs = + if cb.const_polymorphic then Future.force cb.const_universes + else Univ.UContext.empty + in cb.Declarations.const_type, univs + | IndRef ind -> + let (mib, oib) = Inductive.lookup_mind_specif env ind in + let univs = + if mib.mind_polymorphic then mib.mind_universes + else Univ.UContext.empty + in oib.Declarations.mind_arity.Declarations.mind_user_arity, univs + | ConstructRef cstr -> + let (mib,oib as specif) = Inductive.lookup_mind_specif env (inductive_of_constructor cstr) in + let univs = + if mib.mind_polymorphic then mib.mind_universes + else Univ.UContext.empty + in + let inst = Univ.UContext.instance univs in + Inductive.type_of_constructor (cstr,inst) specif, univs let is_polymorphic r = let env = env() in |