12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576(************************************************************************)(* * The Rocq Prover / The Rocq 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) *)(************************************************************************)openNames(* spiwack: I'm choosing, for now, to have [goal_selector] be a
different type than [goal_reference] mostly because if it makes sense
to print a goal that is out of focus (or already solved) it doesn't
make sense to apply a tactic to it. Hence it the types may look very
similar, they do not seem to mean the same thing. *)typet=|SelectAlreadyFocused|SelectListofProofview.goal_range_selectorlist|SelectAllletselect_nthn=SelectList[NthSelectorn]letpr_id_selectorid=Pp.(str"["++Id.printid++str"]")letpr_range_selector=letopenProofviewinfunction|NthSelectori->Pp.inti|RangeSelector(i,j)->Pp.(inti++str"-"++intj)|IdSelectorid->pr_id_selectoridletpr_goal_selector=letopenPpinfunction|SelectAlreadyFocused->str"!"|SelectAll->str"all"|SelectListl->prlist_with_seppr_commapr_range_selectorlletparse_goal_selector=function|"!"->SelectAlreadyFocused|"all"->SelectAll|i->leterr_msg="The default selector must be \"all\", \"!\" or a natural number."inbegintryleti=int_of_stringiinifi<0thenCErrors.user_errPp.(strerr_msg);select_nthiwithFailure_->CErrors.user_errPp.(strerr_msg)end(* Default goal selector: selector chosen when a tactic is applied
without an explicit selector. *)let{Goptions.get=get_default_goal_selector}=Goptions.declare_interpreted_string_option_and_refparse_goal_selector(funv->Pp.string_of_ppcmds@@pr_goal_selectorv)~key:["Default";"Goal";"Selector"]~value:(select_nth1)()(* Select a subset of the goals *)lettclSELECT?nosuchgoalgtac=matchgwith|SelectList[NthSelectori]->Proofview.tclFOCUS?nosuchgoaliitac|SelectList[IdSelectorid]->Proofview.tclFOCUSID?nosuchgoalidtac|SelectListl->Proofview.tclFOCUSSELECTORLIST?nosuchgoalltac|SelectAll->tac|SelectAlreadyFocused->letopenProofview.NotationsinProofview.numgoals>>=funn->ifn==1thentacelselete=CErrors.UserErrorPp.(str"Expected a single focused goal but "++intn++str" goals are focused.")inletinfo=Exninfo.reify()inProofview.tclZERO~infoe