let (curi,metasenv,proofbo,proofty) = proof in
let metano,context,ty = CicUtil.lookup_meta goal metasenv in
let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in
+ let (termty,metasenv',arguments,fresh_meta) =
+ ProofEngineHelpers.saturate_term
+ (ProofEngineHelpers.new_meta_of_proof proof) metasenv context termty in
+ let term = if arguments = [] then term else Cic.Appl (term::arguments) in
let uri,exp_named_subst,typeno,args =
match termty with
C.MutInd (uri,typeno,exp_named_subst) -> (uri,exp_named_subst,typeno,[])
name
| _ -> assert false
in
- let ty_ty,_ = T.type_of_aux' metasenv context ty CicUniv.empty_ugraph in
+ let ty_ty,_ = T.type_of_aux' metasenv' context ty CicUniv.empty_ugraph in
let ext =
match ty_ty with
C.Sort C.Prop -> "_ind"
in
let eliminator_ref = C.Const (eliminator_uri,exp_named_subst) in
let ety,_ =
- T.type_of_aux' metasenv context eliminator_ref CicUniv.empty_ugraph in
+ T.type_of_aux' metasenv' context eliminator_ref CicUniv.empty_ugraph in
let rec find_args_no =
function
C.Prod (_,_,t) -> 1 + find_args_no t
C.Appl (eliminator_ref :: make_tl term (args_no - 1))
in
let metasenv', term_to_refine' =
- CicMkImplicit.expand_implicits metasenv [] context term_to_refine in
+ CicMkImplicit.expand_implicits metasenv' [] context term_to_refine in
let refined_term,_,metasenv'',_ =
CicRefine.type_of_aux' metasenv' context term_to_refine'
CicUniv.empty_ugraph