C.Var (uri,exp_named_subst')
| C.Meta _
| C.Sort _
- | C.Implicit as t -> t
+ | C.Implicit _ as t -> t
| C.Cast (te,ty) -> C.Cast (aux n te, aux n ty)
| C.Prod (nn,s,t) -> C.Prod (nn, aux n s, aux (n+1) t)
| C.Lambda (nn,s,t) -> C.Lambda (nn, aux n s, aux (n+1) t)
let rec aux newmeta =
function
C.Cast (he,_) -> aux newmeta he
+ (* If the expected type is a Type, then also Set is OK ==>
+ * we accept any term of type Type *)
+ (*CSC: BUG HERE: in this way it is possible for the term of
+ * type Type to be different from a Sort!!! *)
+ | C.Prod (name,(C.Sort C.Type as s),t) ->
+ let irl =
+ CicMkImplicit.identity_relocation_list_for_metavariable context
+ in
+ let newargument = C.Meta (newmeta+1,irl) in
+ let (res,newmetasenv,arguments,lastmeta) =
+ aux (newmeta + 2) (S.subst newargument t)
+ in
+ res,
+ (newmeta,[],s)::(newmeta+1,context,C.Meta (newmeta,[]))::newmetasenv,
+ newargument::arguments,lastmeta
| C.Prod (name,s,t) ->
let irl =
CicMkImplicit.identity_relocation_list_for_metavariable context
| _ -> [],newmeta,[],term
in
let metasenv' = metasenv@newmetasenvfragment in
-prerr_endline ("^^^^^TERM': " ^ CicPp.ppterm term') ;
let termty =
CicSubstitution.subst_vars exp_named_subst_diff
(CicTypeChecker.type_of_aux' metasenv' context term)
in
-prerr_endline ("^^^^^TERMTY: " ^ CicPp.ppterm termty) ;
(* newmeta is the lowest index of the new metas introduced *)
let (consthead,newmetas,arguments,_) =
new_metasenv_for_apply newmeta' proof context termty
in
let newmetasenv = metasenv'@newmetas in
let subst,newmetasenv' =
- CicUnification.fo_unif newmetasenv context consthead ty
+ CicUnification.fo_unif newmetasenv context consthead ty
in
let in_subst_domain i = List.exists (function (j,_) -> i=j) subst in
let apply_subst = CicMetaSubst.apply_subst subst in