123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105(************************************************************************)(* * 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) *)(************************************************************************)openNamesopenGenargmoduleTacStore=Store.Make()(** Dynamic toplevel values *)moduleValT=Dyn.Make()moduleVal=structtype'atyp='aValT.tagtype_tag=|Base:'atyp->'atag|List:'atag->'alisttag|Opt:'atag->'aoptiontag|Pair:'atag*'btag->('a*'b)tagtypet=Dyn:'atyp*'a->tleteq=ValT.eqletrepr=ValT.reprletcreate=ValT.createletpr:typea.atyp->Pp.t=funt->Pp.str(reprt)lettyp_list=ValT.create"list"lettyp_opt=ValT.create"option"lettyp_pair=ValT.create"pair"letrecinject:typea.atag->a->t=funtagx->matchtagwith|Baset->Dyn(t,x)|Listtag->Dyn(typ_list,List.map(funx->injecttagx)x)|Opttag->Dyn(typ_opt,Option.map(funx->injecttagx)x)|Pair(tag1,tag2)->Dyn(typ_pair,(injecttag1(fstx),injecttag2(sndx)))endmoduleValTMap=ValT.MapmoduleValReprObj=structtype('raw,'glb,'top)obj='topVal.tagletname="valrepr"letdefault_=NoneendmoduleValRepr=Register(ValReprObj)letrecval_tag:typeabc.(a,b,c)genarg_type->cVal.tag=function|ListArgt->Val.List(val_tagt)|OptArgt->Val.Opt(val_tagt)|PairArg(t1,t2)->Val.Pair(val_tagt1,val_tagt2)|ExtraArgs->ValRepr.obj(ExtraArgs)letval_tag=functionTopwitt->val_tagtletregister_val0wittag=lettag=matchtagwith|None->letname=matchwitwith|ExtraArgs->ArgT.reprs|_->assertfalseinVal.Base(Val.createname)|Sometag->taginValRepr.register0wittag(** Interpretation functions *)typeinterp_sign={lfun:Val.tId.Map.t;poly:bool;extra:TacStore.t}type('glb,'top)interp_fun=interp_sign->'glb->'topFtactic.tmoduleInterpObj=structtype('raw,'glb,'top)obj=('glb,Val.t)interp_funletname="interp"letdefault_=NoneendmoduleInterp=Register(InterpObj)letinterp=Interp.objletgeneric_interpist(GenArg(Glbwitwit,v))=interpwitistvletregister_interp0=Interp.register0