12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667(************************************************************************)(* * 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) *)(************************************************************************)openUtilopenNamesopenConstropenDeclarationsopenEnvironopenContextmoduleRelDecl=Context.Rel.Declarationletrelevance_of_relenvn=letdecl=lookup_relnenvinRelDecl.get_relevancedeclletrelevance_of_varenvx=letdecl=lookup_namedxenvinContext.Named.Declaration.get_relevancedeclletrelevance_of_constantenvc=letdecl=lookup_constantcenvindecl.const_relevanceletrelevance_of_constructorenv((mi,i),_)=letdecl=lookup_mindmienvinletpacket=decl.mind_packets.(i)inpacket.mind_relevanceletrelevance_of_projectionenvp=letmind=Projection.mindpinletmib=lookup_mindmindenvinDeclareops.relevance_of_projection_reprmib(Projection.reprp)letrecrelevance_of_term_extraenvextralftc=matchkindcwith|Reln->ifn<=lftthenRange.getextra(n-1)elserelevance_of_relenv(n-lft)|Varx->relevance_of_varenvx|Sort_|Ind_|Prod_->Sorts.Relevant(* types are always relevant *)|Cast(c,_,_)->relevance_of_term_extraenvextralftc|Lambda({binder_relevance=r;_},_,bdy)->relevance_of_term_extraenv(Range.consrextra)(lft+1)bdy|LetIn({binder_relevance=r;_},_,_,bdy)->relevance_of_term_extraenv(Range.consrextra)(lft+1)bdy|App(c,_)->relevance_of_term_extraenvextralftc|Const(c,_)->relevance_of_constantenvc|Construct(c,_)->relevance_of_constructorenvc|Case(ci,_,_,_,_,_,_)->ci.ci_relevance|Fix((_,i),(lna,_,_))->(lna.(i)).binder_relevance|CoFix(i,(lna,_,_))->(lna.(i)).binder_relevance|Proj(p,_)->relevance_of_projectionenvp|Int_|Float_->Sorts.Relevant|Array_->Sorts.Relevant|Meta_|Evar_->Sorts.Relevant(* let's assume metas and evars are relevant for now *)letrelevance_of_termenvc=relevance_of_term_extraenvRange.empty0c