123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990(************************************************************************)(* * 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) *)(************************************************************************)openUtilopenGenargopenGeninterpopenLtac2_pluginopenTac2valopenTac2ffiopenTac2expropenProofview.NotationsopenTac2externalsletltac2_ltac1_plugin="rocq-runtime.plugins.ltac2_ltac1"letpname?(plugin=ltac2_ltac1_plugin)s={mltac_plugin=plugin;mltac_tactic=s}letdefine?plugins=define(pname?plugins)letltac1=Tac2ffi.repr_extTac2ffi.val_ltac1letval_tagwit=matchval_tagwitwith|Baset->t|_->assertfalseletprj:typea.aVal.typ->Val.t->aoption=funtv->letVal.Dyn(t',x)=vinmatchVal.eqtt'with|None->None|SomeRefl->Somexletin_genwitv=Val.Dyn(val_tagwit,v)letout_genwitv=prj(val_tagwit)vlet()=define"ltac1_of_intro_pattern"(Tac2stdlib.intro_pattern@->retltac1)@@funv->letv=Tac2tactics.mk_intro_patternvinin_gen(topwitLtac_plugin.Tacarg.wit_simple_intropattern)vletrecto_intro_pattern(v:Tactypes.intro_pattern):Tac2types.intro_pattern=matchv.CAst.vwith|IntroForthcomingb->IntroForthcomingb|IntroNamingpat->IntroNaming(to_intro_pattern_namingpat)|IntroActionact->IntroAction(to_intro_pattern_actionact)(* these types have the same definition but aren't equal *)andto_intro_pattern_naming:Namegen.intro_pattern_naming_expr->Tac2types.intro_pattern_naming=function|IntroIdentifierid->IntroIdentifierid|IntroFreshid->IntroFreshid|IntroAnonymous->IntroAnonymousandto_intro_pattern_action:Tactypes.delayed_open_constrTactypes.intro_pattern_action_expr->Tac2types.intro_pattern_action=function|IntroWildcard->IntroWildcard|IntroOrAndPatternop->IntroOrAndPattern(to_or_and_intro_patternop)|IntroInjectioninj->IntroInjection(to_intro_patternsinj)|IntroApplyOn({loc;v=c},ipat)->letc=letopenProofviewinGoal.enter_one~__LOC__@@fungl->letsigma,c=c(Goal.envgl)(Goal.sigmagl)inProofview.Unsafe.tclEVARSsigma>>=fun()->tclUNIT(of_constrc)inletc=to_fun1unitconstr(mk_closure_valarity_one(fun_->c))inIntroApplyOn(c,to_intro_patternipat)|IntroRewriteb->IntroRewritebandto_or_and_intro_pattern:Tactypes.delayed_open_constrTactypes.or_and_intro_pattern_expr->Tac2types.or_and_intro_pattern=function|IntroOrPatternill->IntroOrPattern(List.mapto_intro_patternsill)|IntroAndPatternil->IntroAndPattern(to_intro_patternsil)andto_intro_patternsv=List.mapto_intro_patternvlet()=define"ltac1_to_intro_pattern"(ltac1@->ret(optionTac2stdlib.intro_pattern))@@funv->(* should we be using Taccoerce.coerce_to_intro_pattern instead?
semantics are different: it also handles wit_hyp and Var constr *)matchout_gen(topwitLtac_plugin.Tacarg.wit_simple_intropattern)vwith|None->None|Somev->letv=to_intro_patternvinSomev