12345678910111213141516171819202122232425262728293031323334353637383940414243444546(************************************************************************)(* * 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) *)(************************************************************************)openNamesletscheme_map=Summary.refIndmap.empty~name:"Schemes"letcache_one_schemekind(ind,const)=scheme_map:=Indmap.updateind(function|None->Some(CString.Map.singletonkindconst)|Somemap->Some(CString.Map.addkindconstmap))!scheme_mapletcache_scheme(kind,l)=cache_one_schemekindlletsubst_one_schemesubst(ind,const)=(* Remark: const is a def: the result of substitution is a constant *)(Mod_subst.subst_indsubstind,Mod_subst.subst_constantsubstconst)letsubst_scheme(subst,(kind,l))=(kind,subst_one_schemesubstl)letdischarge_scheme(kind,l)=Some(kind,l)letinScheme:string*(inductive*Constant.t)->Libobject.obj=letopenLibobjectindeclare_object@@superglobal_object"SCHEME"~cache:cache_scheme~subst:(Somesubst_scheme)~discharge:discharge_schemeletdeclare_schemekindindcl=Lib.add_leaf(inScheme(kind,indcl))letlookup_schemekindind=CString.Map.findkind(Indmap.findind!scheme_map)letall_schemes()=!scheme_map