(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* c :: acc | _ -> fold_constr evrec acc c in evrec [] c let instantiate n rawc ido gl = let wc = Refiner.project_with_focus gl in let evl = match ido with ConclLocation () -> evars_of wc.sigma gl.it.evar_concl | HypLocation (id,hloc) -> let decl = Sign.lookup_named id gl.it.evar_hyps in match hloc with InHyp -> (match decl with (_,None,typ) -> evars_of wc.sigma typ | _ -> error "please be more specific : in type or value ?") | InHypTypeOnly -> let (_, _, typ) = decl in evars_of wc.sigma typ | InHypValueOnly -> (match decl with (_,Some body,_) -> evars_of wc.sigma body | _ -> error "not a let .. in hypothesis") in if List.length evl < n then error "not enough uninstantiated existential variables"; if n <= 0 then error "incorrect existential variable index"; let ev,_ = destEvar (List.nth evl (n-1)) in let wc' = w_refine ev rawc wc in Tacticals.tclIDTAC {gl with sigma = wc'.sigma} (* let pfic gls c = let evc = gls.sigma in Constrintern.interp_constr evc (Global.env_of_context gls.it.evar_hyps) c let instantiate_tac = function | [Integer n; Command com] -> (fun gl -> instantiate n (pfic gl com) gl) | [Integer n; Constr c] -> (fun gl -> instantiate n c gl) | _ -> invalid_arg "Instantiate called with bad arguments" *) let let_evar nam typ gls = let sp = Evarutil.new_evar () in let mm = (Evarutil.create_evar_defs gls.sigma, Metamap.empty) in let (evd,_) = Unification.w_Declare (pf_env gls) sp typ mm in let ngls = {gls with sigma = Evarutil.evars_of evd} in Tactics.forward true nam (mkEvar(sp,[||])) ngls