(NCicPp.ppterm ~subst ~metasenv ~context y)
(NCicPp.ppterm ~subst ~metasenv ~context x))))
+and guess_name subst ctx ty =
+ let aux initial = "#" ^ String.make 1 initial in
+ match ty with
+ | C.Const (NReference.Ref (u,_))
+ | C.Appl (C.Const (NReference.Ref (u,_)) :: _) ->
+ aux (String.sub (NUri.name_of_uri u) 0 1).[0]
+ | C.Prod _ -> aux 'f'
+ | C.Meta (n,lc) ->
+ (try
+ let _,_,t,_ = NCicUtils.lookup_subst n subst in
+ guess_name subst ctx (NCicSubstitution.subst_meta lc t)
+ with NCicUtils.Subst_not_found _ -> aux 'M')
+ | _ -> aux 'H'
+
and eat_prods hdb
~localise ~look_for_coercion metasenv subst context orig_he he ty_he args
=
let metasenv, subst, arg, ty_arg =
typeof hdb ~look_for_coercion ~localise
metasenv subst context arg None in
+ let name = guess_name subst context ty_arg in
let metasenv, _, meta, _ =
NCicMetaSubst.mk_meta metasenv
- (("_",C.Decl ty_arg) :: context) `Type
+ ((name,C.Decl ty_arg) :: context) `Type
in
- let flex_prod = C.Prod ("_", ty_arg, meta) in
+ let flex_prod = C.Prod (name, ty_arg, meta) in
(* next line grants that ty_args is a type *)
let metasenv,subst, flex_prod, _ =
typeof hdb ~look_for_coercion ~localise metasenv subst