123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122(************************************************************************)(* * The Coq Proof Assistant / The Coq 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) *)(************************************************************************)openNamesopenConstropenMod_substtypeglobal_reference=GlobRef.t=|VarRefofvariable[@ocaml.deprecated"Use Names.GlobRef.VarRef"]|ConstRefofConstant.t[@ocaml.deprecated"Use Names.GlobRef.ConstRef"]|IndRefofinductive[@ocaml.deprecated"Use Names.GlobRef.IndRef"]|ConstructRefofconstructor[@ocaml.deprecated"Use Names.GlobRef.ConstructRef"][@@ocaml.deprecated"Use Names.GlobRef.t"]openGlobRefletisVarRef=functionVarRef_->true|_->falseletisConstRef=functionConstRef_->true|_->falseletisIndRef=functionIndRef_->true|_->falseletisConstructRef=functionConstructRef_->true|_->falseletdestVarRef=functionVarRefind->ind|_->failwith"destVarRef"letdestConstRef=functionConstRefind->ind|_->failwith"destConstRef"letdestIndRef=functionIndRefind->ind|_->failwith"destIndRef"letdestConstructRef=functionConstructRefind->ind|_->failwith"destConstructRef"letsubst_global_referencesubstref=matchrefwith|VarRefvar->ref|ConstRefkn->letkn'=subst_constantsubstkninifkn==kn'thenrefelseConstRefkn'|IndRefind->letind'=subst_indsubstindinifind==ind'thenrefelseIndRefind'|ConstructRef((kn,i),jasc)->letc'=subst_constructorsubstcinifc'==cthenrefelseConstructRefc'letsubst_globalsubstref=matchrefwith|VarRefvar->ref,None|ConstRefkn->letkn',t=subst_consubstkninifkn==kn'thenref,NoneelseConstRefkn',t|IndRefind->letind'=subst_indsubstindinifind==ind'thenref,NoneelseIndRefind',None|ConstructRef((kn,i),jasc)->letc'=subst_constructorsubstcinifc'==cthenref,NoneelseConstructRefc',Noneletcanonical_gr=function|ConstRefcon->ConstRef(Constant.make1(Constant.canonicalcon))|IndRef(kn,i)->IndRef(MutInd.make1(MutInd.canonicalkn),i)|ConstructRef((kn,i),j)->ConstructRef((MutInd.make1(MutInd.canonicalkn),i),j)|VarRefid->VarRefidletglobal_of_constrc=matchkindcwith|Const(sp,u)->ConstRefsp|Ind(ind_sp,u)->IndRefind_sp|Construct(cstr_cp,u)->ConstructRefcstr_cp|Varid->VarRefid|_->raiseNot_foundletis_global=Constr.isRefXletprintable_constr_of_global=function|VarRefid->mkVarid|ConstRefsp->mkConstsp|ConstructRefsp->mkConstructsp|IndRefsp->mkIndsp(* Extended global references *)typesyndef_name=KerName.ttypeextended_global_reference=|TrueGlobalofGlobRef.t|SynDefofsyndef_name(* We order [extended_global_reference] via their user part
(cf. pretty printer) *)moduleExtRefOrdered=structtypet=extended_global_referenceletequalxy=x==y||matchx,ywith|TrueGlobalrx,TrueGlobalry->GlobRef.UserOrd.equalrxry|SynDefknx,SynDefkny->KerName.equalknxkny|(TrueGlobal_|SynDef_),_->falseletcomparexy=ifx==ythen0elsematchx,ywith|TrueGlobalrx,TrueGlobalry->GlobRef.UserOrd.comparerxry|SynDefknx,SynDefkny->KerName.compareknxkny|TrueGlobal_,SynDef_->-1|SynDef_,TrueGlobal_->1openHashset.Combinelethash=function|TrueGlobalgr->combinesmall1(GlobRef.UserOrd.hashgr)|SynDefkn->combinesmall2(KerName.hashkn)endmoduleExtRefMap=HMap.Make(ExtRefOrdered)moduleExtRefSet=ExtRefMap.Setletsubst_extended_referencesub=function|SynDefkn->SynDef(subst_knsubkn)|TrueGlobalgr->TrueGlobal(subst_global_referencesubgr)