12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(************************************************************************)(* * The Coq Proof Assistant / The Coq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openPp(* This module implements the abstract interface to goals *)(* A general invariant of the module, is that a goal whose associated
evar is defined in the current evar_map, should not be accessed. *)(* type of the goals *)typegoal=Evar.tletpr_goale=str"GOAL:"++Pp.int(Evar.repre)letuide=string_of_int(Evar.repre)(* Layer to implement v8.2 tactic engine ontop of the new architecture.
Types are different from what they used to be due to a change of the
internal types. *)moduleV82=struct(* Old style env primitive *)letenvevarsgl=letenv=Global.env()inletevi=Evd.findevarsglinEvd.evar_filtered_envenvevi(* Old style hyps primitive *)lethypsevarsgl=letevi=Evd.findevarsglinEvd.evar_filtered_hypsevi(* same as [hyps], but ensures that existential variables are
normalised. *)letnf_hypsevarsgl=lethyps=Environ.named_context_of_val(hypsevarsgl)inEnviron.val_of_named_context(Evarutil.nf_named_context_evarevarshyps)(* Access to ".evar_concl" *)letconclevarsgl=letevi=Evd.findevarsglinevi.Evd.evar_concl(* Old style mk_goal primitive *)letmk_goalevarshypsconcl=(* A goal created that way will not be used by refine and will not
be shelved. It must not appear as a future_goal, so the future
goals are restored to their initial value after the evar is
created. *)letevars=Evd.push_future_goalsevarsinletinst=EConstr.identity_subst_valhypsinletidentity=Evd.Identity.makeinstinlet(evars,evk)=Evarutil.new_pure_evar~src:(Loc.tagEvar_kinds.GoalEvar)~typeclass_candidate:false~identityhypsevarsconclinlet_,evars=Evd.pop_future_goalsevarsinletev=EConstr.mkEvar(evk,inst)in(evk,ev,evars)(* Instantiates a goal with an open term *)letpartial_solutionenvsigmaevkc=(* Check that the goal itself does not appear in the refined term *)let_=ifnot(Evarutil.occur_evar_uptosigmaevkc)then()elsePretype_errors.error_occur_checkenvsigmaevkcinEvd.defineevkcsigma(* Used by the compatibility layer and typeclasses *)letnf_evarsigmagl=letevi=Evd.findsigmaglinletevi=Evarutil.nf_evar_infosigmaeviinletsigma=Evd.addsigmagleviin(gl,sigma)endmoduleSet=Evar.Set