aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-10-24 11:52:21 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-10-24 11:52:21 +0000
commit9a3479cce80db66cad0a3f97c91e3cffab536aec (patch)
tree1dd0edfdf9ce2acdf9211b59143b5e72a28d12d5 /pretyping
parent504c4a71513fddfe4d6328370a343aea06765648 (diff)
More unification in type_of and addition of e_type_of to get the new
evar_map after instantiations possibly happened. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14586 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/typing.ml11
-rw-r--r--pretyping/typing.mli3
2 files changed, 14 insertions, 0 deletions
diff --git a/pretyping/typing.ml b/pretyping/typing.ml
index ebd099fa3..7f84828f1 100644
--- a/pretyping/typing.ml
+++ b/pretyping/typing.ml
@@ -45,6 +45,11 @@ let e_judge_of_apply env evdref funj argjv =
apply_rec (n+1) (subst1 hj.uj_val c2) restjl
else
error_cant_apply_bad_type env (n,c1, hj.uj_type) funj argjv
+ | Evar ev ->
+ let (evd',t) = Evarutil.define_evar_as_product !evdref ev in
+ evdref := evd';
+ let (_,_,c2) = destProd t in
+ apply_rec (n+1) (subst1 hj.uj_val c2) restjl
| _ ->
error_cant_apply_not_functional env funj argjv
in
@@ -261,6 +266,12 @@ let sort_of env evd c =
(* Try to solve the existential variables by typing *)
+let e_type_of env evd c =
+ let evdref = ref evd in
+ let j = execute env evdref c in
+ (* side-effect on evdref *)
+ !evdref, Termops.refresh_universes j.uj_type
+
let solve_evars env evd c =
let evdref = ref evd in
let c = (execute env evdref c).uj_val in
diff --git a/pretyping/typing.mli b/pretyping/typing.mli
index 2c9a6c6c0..224fd995a 100644
--- a/pretyping/typing.mli
+++ b/pretyping/typing.mli
@@ -17,6 +17,9 @@ open Evd
(** Typecheck a term and return its type *)
val type_of : env -> evar_map -> constr -> types
+(** Typecheck a term and return its type + updated evars *)
+val e_type_of : env -> evar_map -> constr -> evar_map * types
+
(** Typecheck a type and return its sort *)
val sort_of : env -> evar_map -> types -> sorts