123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(************************************************************************)(* * 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) *)(************************************************************************)openGenredexprletunion_constsl1l2=Util.List.union(=)l1l2(* FIXME *)letall_flags={rBeta=true;rMatch=true;rFix=true;rCofix=true;rZeta=true;rDelta=true;rConst=[];rStrength=Norm;}letmake_red_flagl=letrecadd_flagred=function|[]->red|FHead::lf->add_flag{redwithrStrength=Head}lf|FBeta::lf->add_flag{redwithrBeta=true}lf|FMatch::lf->add_flag{redwithrMatch=true}lf|FFix::lf->add_flag{redwithrFix=true}lf|FCofix::lf->add_flag{redwithrCofix=true}lf|FZeta::lf->add_flag{redwithrZeta=true}lf|FConstl::lf->ifred.rDeltathenCErrors.user_errPp.(str"Cannot set both constants to unfold and constants not to unfold");add_flag{redwithrConst=union_constsred.rConstl}lf|FDeltaButl::lf->ifred.rConst<>[]&¬red.rDeltathenCErrors.user_errPp.(str"Cannot set both constants to unfold and constants not to unfold");add_flag{redwithrConst=union_constsred.rConstl;rDelta=true}lfinadd_flag{rBeta=false;rMatch=false;rFix=false;rCofix=false;rZeta=false;rDelta=false;rConst=[];rStrength=Norm;}lletmake_red_flag=function|[FHead]->{all_flagswithrStrength=Head}|l->make_red_flagl(** Mapping [red_expr_gen] *)letmap_flagsfflags={flagswithrConst=List.mapfflags.rConst}letmap_occsf(occ,e)=(occ,fe)letmap_red_expr_genfgh=function|Foldl->Fold(List.mapfl)|Patternoccs_l->Pattern(List.map(map_occsf)occs_l)|Simpl(flags,occs_o)->Simpl(map_flagsgflags,Option.map(map_occs(Util.map_uniongh))occs_o)|Unfoldoccs_l->Unfold(List.map(map_occsg)occs_l)|Cbvflags->Cbv(map_flagsgflags)|Lazyflags->Lazy(map_flagsgflags)|CbvVmoccs_o->CbvVm(Option.map(map_occs(Util.map_uniongh))occs_o)|CbvNativeoccs_o->CbvNative(Option.map(map_occs(Util.map_uniongh))occs_o)|Cbnflags->Cbn(map_flagsgflags)|ExtraRedExpr_|Red|Hnfasx->x