123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657(******************************************************************************)(* This file is part of Waterproof-lib. *)(* *)(* Waterproof-lib is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as published by *)(* the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* Waterproof-lib is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public License *)(* along with Waterproof-lib. If not, see <https://www.gnu.org/licenses/>. *)(* *)(******************************************************************************)openProofviewopenProofview.Notations(**
Checks whether a given evar is a blank in the evar_map.
*)letis_blank(ev_map:Evd.evar_map)(ev:Evar.t):bool=letev_info=Evd.findev_mapevinlet_,ev_kind=(Evd.evar_sourceev_info)inmatchev_kindwith|Evar_kinds.QuestionMark_->true|_->false(**
A tactic that resturns a list of all evars in a term (= Evd.econstr) that
were introduced by the user as a blank and have not been resolved yet.
*)letblank_evars_in_term(term:Evd.econstr):Evar.tlisttactic=tclEVARMAP>>=funsigma->tclUNIT@@letevars=Evarutil.undefined_evars_of_termsigmaterminList.filter(is_blanksigma)(Evar.Set.elementsevars)(**
Refines the current goal with just a new named evar, the name of which is
freshly generated based on the input string.
*)letrefine_goal_with_evar(input:string):unittactic=letsrc=(Loc.tagEvar_kinds.GoalEvar)inProofview.Goal.enterbeginfungl->letenv=Proofview.Goal.envglinletconcl=Proofview.Goal.conclglinRefine.refine~typecheck:truebeginfunctionsigma->letsigma,t=Evarutil.new_evar~src~naming:(Namegen.IntroFresh(Names.Id.of_stringinput))envsigmaconclin(sigma,t)endend