123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113(************************************************************************)(* * 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) *)(************************************************************************)openGoptionsmoduleDyn=Dyn.Make()moduleDMap=Dyn.Map(structtype'at='a->unitProofview.tacticend)letinterp_map=refDMap.emptytypeinterpretable=I:'aDyn.tag*'a->interpretabletype'atactic_interpreter=Interpreterof('a->interpretable)letregister_tactic_interpreternaf=lett=Dyn.createnaininterp_map:=DMap.addtf!interp_map;Interpreter(funx->I(t,x))letinterp_tac(I(tag,t))=letf=DMap.findtag!interp_mapinfttypeparallel_solver=pstate:Declare.Proof.t->info:intoption->interpretable->abstract:bool->Declare.Proof.tlet{Goptions.get=print_info_trace}=declare_intopt_option_and_ref~key:["Info";"Level"]~value:None()letwarn_end_tac=CWarnings.create_warning~name:"deprecated-end-tac"~from:[Deprecation.Version.v9_2]()letpp_warn_end_tac=letpptacend_tac=letenv=Global.env()inletsigma=Evd.from_envenvinletpptac=Gentactic.print_globenvsigmaend_tacinPp.(str";"++spc()++pptac++str".")inCWarnings.create_inwarn_end_tac~quickfix:(fun~locend_tac->[Quickfix.make~loc(pptacend_tac)])Pp.(funend_tac->fmt"Using \"...\" is deprecated, use \"%t\" instead"(fun()->pptacend_tac))letwarn_end_tac?locend_tac=matchend_tacwith|None->CErrors.user_err?locPp.(str"This \"...\" is useless, use \".\" instead.")|Someend_tac->pp_warn_end_tac?locend_tacletuse_end_tac~with_end_tacend_tac=ifnotwith_end_tac.CAst.vthenNoneelsebeginwarn_end_tac?loc:with_end_tac.locend_tac;Option.mapGentactic.interpend_tacendletsolve_core~pstaten~info?(with_end_tac=CAst.makefalse)t=letpstate,status=Declare.Proof.map_fold_endline~f:(funetacp->letwith_end_tac=use_end_tac~with_end_tacetacinletinfo=Option.appendinfo(print_info_trace())inlet(p,status)=Proof.solve(Global.env())ninfot?with_end_tacpin(* in case a strict subtree was completed,
go back to the top of the prooftree *)letp=Proof.maximal_unfocusVernacentries.command_focuspinp,status)pstateinletpstate=Declare.Internal.register_side_effectspstateinifnotstatusthenFeedback.feedbackFeedback.AddedAxiom;pstateletsolve~pstaten~info?with_end_tact=lett=interp_tactinsolve_core~pstaten~infot?with_end_tacletcheck_par_applicablepstate=Declare.Proof.foldpstate~f:(funp->(Proof.datap).Proof.goals|>List.iter(fungoal->letis_ground=let{Proof.sigma=sigma0}=Declare.Proof.foldpstate~f:Proof.datainletg=Evd.find_undefinedsigma0goalinletconcl,hyps=Evd.evar_conclg,Evd.evar_contextginEvarutil.is_ground_termsigma0concl&&List.for_all(Context.Named.Declaration.for_all(Evarutil.is_ground_termsigma0))hypsinifnotis_groundthenCErrors.user_errPp.(strbrk("The par: goal selector does not support goals with existential variables"))))letpar_implementation:parallel_solverref=ref(fun~pstate~infot~abstract->lett=interp_tactinlett=Proofview.Goal.enter(fun_->ifabstractthenAbstract.tclABSTRACTNone~opaque:truetelset)insolve_core~pstateGoal_select.SelectAll~infot)letset_par_implementationf=par_implementation:=fletsolve_parallel~pstate~infot~abstract=check_par_applicablepstate;!par_implementation~pstate~infot~abstract