12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388(************************************************************************)(* * 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) *)(************************************************************************)openPpopenNamesopenCErrorsopenUtilopenCAstopenExtendopenConstrexpropenVernacexpropenDeclaremodsopenPputilsopenPpconstrletdo_not_tag_x=xlettag_keyword=do_not_tag()lettag_vernac=do_not_tagletkeywords=tag_keyword(strs)letpr_smart_global=Pputils.pr_or_by_notationpr_qualidletpr_in_global_envfc:Pp.t=letenv=Global.env()inletsigma=Evd.from_envenvinfenvsigmac(* when not !Flags.beautify_file these just ignore the env/sigma *)letpr_constr_expr=pr_in_global_envpr_constr_exprletpr_lconstr_expr=pr_in_global_envpr_lconstr_exprletpr_binders=pr_in_global_envpr_bindersletpr_constr_pattern_expr=pr_in_global_envpr_constr_pattern_expr(* In principle this may use the env/sigma, in practice not sure if it
does except through pr_constr_expr in beautify mode. *)letpr_gen=pr_in_global_envPputils.pr_raw_generic(* No direct Global.env or pr_in_global_env use after this *)letpr_constr=pr_constr_exprletpr_lconstr=pr_lconstr_exprletpr_spc_lconstr=pr_sep_comspc@@pr_lconstr_exprletpr_red_expr=Ppred.pr_red_expr(pr_constr_expr,pr_lconstr_expr,pr_smart_global,pr_constr_expr)keywordletpr_uconstraint(l,d,r)=pr_sort_name_exprl++spc()++Univ.pr_constraint_typed++spc()++pr_sort_name_exprrletpr_full_univ_name_list=function|None->mt()|Some(ql,ul)->str"@{"++prlist_with_sepspcpr_lnameql++(ifList.is_emptyqlthenmt()elsestrbrk" | ")++prlist_with_sepspcpr_lnameul++str"}"letpr_variance_lident(lid,v)=letv=Option.cataUVars.Variance.pr(mt())vinv++pr_lidentlidletpr_univdecl_instancelextensible=prlist_with_sepspcpr_lidentl++(ifextensiblethenstr"+"elsemt())letpr_cumul_univdecl_instancelextensible=prlist_with_sepspcpr_variance_lidentl++(ifextensiblethenstr"+"elsemt())letpr_univdecl_constraintslextensible=ifList.is_emptyl&&extensiblethenmt()elsestr"|"++spc()++prlist_with_sep(fun()->strbrk" | ")pr_uconstraintl++(ifextensiblethenstr"+"elsemt())letpr_universe_decll=letopenUStateinmatchlwith|None->mt()|Somel->str"@{"++pr_univdecl_instancel.univdecl_instancel.univdecl_extensible_instance++pr_univdecl_constraintsl.univdecl_constraintsl.univdecl_extensible_constraints++str"}"letpr_cumul_univ_decll=letopenUStateinmatchlwith|None->mt()|Somel->str"@{"++pr_cumul_univdecl_instancel.univdecl_instancel.univdecl_extensible_instance++pr_univdecl_constraintsl.univdecl_constraintsl.univdecl_extensible_constraints++str"}"letpr_ident_decl(lid,l)=pr_lidentlid++pr_universe_decllletpr_cumul_ident_decl(lid,l)=pr_lidentlid++pr_cumul_univ_decllletstring_of_fqidfqid=String.concat"."(List.mapId.to_stringfqid)letpr_fqidfqid=str(string_of_fqidfqid)letpr_lfqid{CAst.loc;v=fqid}=matchlocwith|None->pr_fqidfqid|Someloc->let(b,_)=Loc.unloclocinpr_locatedpr_fqid@@Loc.tag~loc:(Loc.make_loc(b,b+String.length(string_of_fqidfqid)))fqidletpr_lname_decl(n,u)=pr_lnamen++pr_universe_decluletpr_ltac_ref=Libnames.pr_qualidletpr_module=Libnames.pr_qualidletpr_import_cats=function|None->mt()|Some{negative;import_cats=cats}->(ifnegativethenstr"-"elsemt())++str"("++prlist_with_sep(fun()->str",")(funx->strx.v)cats++str")"letpr_one_import_filter_name(q,etc)=Libnames.pr_qualidq++ifetcthenstr"(..)"elsemt()letpr_import_module(m,f)=Libnames.pr_qualidm++matchfwith|ImportAll->mt()|ImportNamesns->surround(prlist_with_seppr_commapr_one_import_filter_namens)letsep_end=function|VernacSynPure(VernacBullet_|VernacSubproof_|VernacEndSubproof)->str""|_->str"."letsep=fun_->spc()letsep_v2=fun_->str","++spc()letstring_of_theorem_kind=letopenDeclsinfunction|Theorem->"Theorem"|Lemma->"Lemma"|Fact->"Fact"|Remark->"Remark"|Property->"Property"|Proposition->"Proposition"|Corollary->"Corollary"letstring_of_definition_object_kind=letopenDeclsinfunction|Definition->"Definition"|Example->"Example"|Coercion->"Coercion"|SubClass->"SubClass"|CanonicalStructure->"Canonical Structure"|Instance->"Instance"|Let->"Let"|(StructureComponent|Scheme|CoFixpoint|Fixpoint|IdentityCoercion|Method)->CErrors.anomaly(Pp.str"Internal definition kind.")letstring_of_assumption_kind=letopenDeclsinfunction|Definitional->"Parameter"|Logical->"Axiom"|Conjectural->"Conjecture"|Context->"Context"letstring_of_logical_kind=letopenDeclsinfunction|IsAssumptionk->string_of_assumption_kindk|IsDefinitionk->string_of_definition_object_kindk|IsProofk->string_of_theorem_kindk|IsPrimitive->"Primitive"letpr_notation_entry=function|InConstrEntry->keyword"constr"|InCustomEntrys->keyword"custom"++spc()++strsletpr_abbreviationpr(ids,c)=prc++spc()++prlist_with_sepspcpr_ididsletpr_at_level=function|NumLeveln->spc()++keyword"at"++spc()++keyword"level"++spc()++intn|NextLevel->spc()++keyword"at"++spc()++keyword"next"++spc()++keyword"level"|DefaultLevel->mt()letlevel_of_pattern_level=functionNone->DefaultLevel|Somen->NumLevelnletpr_constr_as_binder_kind=letopenNotation_terminfunction|AsIdent->spc()++keyword"as ident"|AsName->spc()++keyword"as name"|AsAnyPattern->spc()++keyword"as pattern"|AsStrictPattern->spc()++keyword"as strict pattern"letpr_strictb=ifbthenstr"strict "elsemt()letpr_set_entry_typepr=function|ETIdent->str"ident"|ETName->str"name"|ETGlobal->str"global"|ETPattern(b,n)->pr_strictb++str"pattern"++pr_at_level(level_of_pattern_leveln)|ETConstr(s,bko,lev)->pr_notation_entrys++prlev++pr_optpr_constr_as_binder_kindbko|ETBigint->str"bigint"|ETBindertrue->str"binder"|ETBinderfalse->str"closed binder"letpr_set_simple_entry_type=pr_set_entry_typepr_at_levelletpr_commentpr_c=function|CommentConstrc->pr_cc|CommentStrings->qss|CommentIntn->intnletpr_in_out_modules=function|SearchInsidel->spc()++keyword"inside"++spc()++prlist_with_sepseppr_modulel|SearchOutside[]->mt()|SearchOutsidel->spc()++keyword"outside"++spc()++prlist_with_sepseppr_modulelletpr_search_where=function|Anywhere,false->mt()|Anywhere,true->str"head:"|InHyp,true->str"headhyp:"|InHyp,false->str"hyp:"|InConcl,true->str"headconcl:"|InConcl,false->str"concl:"letpr_delimiter_depth=function|DelimOnlyTmpScope->str"%_"|DelimUnboundedScope->str"%"letpr_scope_delimiter(d,sc)=pr_delimiter_depthd++strscletpr_search_item=function|SearchSubPattern(where,p)->pr_search_wherewhere++pr_constr_pattern_exprp|SearchString(where,s,sc)->pr_search_wherewhere++qss++pr_optpr_scope_delimitersc|SearchKindkind->str"is:"++str(string_of_logical_kindkind)letrecpr_search_request=function|SearchLiterala->pr_search_itema|SearchDisjConjl->str"["++prlist_with_sepspc(prlist_with_seppr_barpr_search_default)l++str"]"andpr_search_default(b,s)=(ifbthenmt()elsestr"-")++pr_search_requestsletpr_searchagoptbpr_p=pr_opt(fung->Goal_select.pr_goal_selectorg++str":"++spc())gopt++matchawith|SearchPatternc->keyword"SearchPattern"++spc()++pr_pc++pr_in_out_modulesb|SearchRewritec->keyword"SearchRewrite"++spc()++pr_pc++pr_in_out_modulesb|Searchsl->keyword"Search"++spc()++prlist_with_sepspcpr_search_defaultsl++pr_in_out_modulesbletpr_option_ref_value=function|Goptions.QualidRefValueid->pr_qualidid|Goptions.StringRefValues->qssletpr_printoptiontableb=prlist_with_sepspcstrtable++pr_opt(prlist_with_sepseppr_option_ref_value)bletpr_set_optionab=pr_printoptionaNone++(matchbwith|OptionUnset|OptionSetTrue->mt()|OptionSetIntn->spc()++intn|OptionSetStrings->spc()++quote(strs))letpr_opt_hintbasesl=matchlwith|[]->mt()|_asz->str":"++spc()++prlist_with_sepsepstrzletpr_reference_or_constrpr_c=function|HintsReferencer->pr_qualidr|HintsConstrc->pr_ccletpr_hint_mode=letopenHintsinfunction|ModeInput->str"+"|ModeNoHeadEvar->str"!"|ModeOutput->str"-"letpr_hint_infopr_pat{Typeclasses.hint_priority=pri;hint_pattern=pat}=pr_opt(funx->str"|"++intx)pri++pr_opt(funy->(ifOption.is_emptyprithenstr"| "elsemt())++pr_paty)patletpr_hintsdbhpr_cpr_pat=letopth=pr_opt_hintbasesdbinletpph=letopenHintsinmatchhwith|HintsResolvel->keyword"Resolve "++prlist_with_sepsep(fun(info,_,c)->pr_reference_or_constrpr_cc++pr_hint_infopr_patinfo)l|HintsResolveIFF(l2r,l,n)->keyword"Resolve "++str(ifl2rthen"->"else"<-")++prlist_with_sepseppr_qualidl|HintsImmediatel->keyword"Immediate"++spc()++prlist_with_sepsep(func->pr_reference_or_constrpr_cc)l|HintsUnfoldl->keyword"Unfold"++spc()++prlist_with_sepseppr_qualidl|HintsTransparency(l,b)->keyword(ifbthen"Transparent"else"Opaque")++spc()++(matchlwith|HintsVariables->keyword"Variables"|HintsConstants->keyword"Constants"|HintsReferencesl->prlist_with_sepseppr_qualidl)|HintsMode(m,l)->keyword"Mode"++spc()++pr_qualidm++spc()++prlist_with_sepspcpr_hint_model|HintsConstructorsc->keyword"Constructors"++spc()++prlist_with_sepspcpr_qualidc|HintsExtern(n,c,tac)->letpat=matchcwithNone->mt()|Somepat->pr_patpatinkeyword"Extern"++spc()++intn++spc()++pat++str" =>"++spc()++pr_gentacinhov2(keyword"Hint "++pph++opth)letpr_with_declarationpr_c=function|CWith_Definition(id,udecl,c)->letp=pr_ccinkeyword"Definition"++spc()++pr_lfqidid++pr_universe_decludecl++str" := "++p|CWith_Module(id,qid)->keyword"Module"++spc()++pr_lfqidid++str" := "++pr_qualidqidletrecpr_module_astleading_spacepr_c=function|{loc;v=CMidentqid}->ifleading_spacethenspc()++pr_locatedpr_qualid(loc,qid)elsepr_locatedpr_qualid(loc,qid)|{v=CMwith(mty,decl)}->letm=pr_module_astleading_spacepr_cmtyinletp=pr_with_declarationpr_cdeclinm++spc()++keyword"with"++spc()++p|{v=CMapply(me1,me2)}->pr_module_astleading_spacepr_cme1++spc()++pr_locatedpr_qualid(me2.loc,me2)letpr_inline=function|DefaultInline->mt()|NoInline->str"[no inline]"|InlineAti->str"[inline at level "++inti++str"]"letpr_assumption_inline=function|DefaultInline->str"Inline"|NoInline->mt()|InlineAti->str"Inline("++inti++str")"letpr_module_ast_inlleading_spacepr_c(mast,inl)=pr_module_astleading_spacepr_cmast++pr_inlineinlletpr_of_module_typeprc=function|Enforcemty->str":"++pr_module_ast_inltrueprcmty|Checkmtys->prlist_strict(funm->str"<:"++pr_module_ast_inltrueprcm)mtysletpr_export_flag=function|Export->keyword"Export"|Import->keyword"Import"letpr_export_with_cats(export,cats)=pr_export_flagexport++pr_import_catscatsletpr_require_token=function|Someexport->pr_export_with_catsexport++spc()|None->mt()letpr_module_vardeclspr_c(export,idl,(mty,inl))=letm=pr_module_asttruepr_cmtyinspc()++hov1(str"("++pr_require_tokenexport++prlist_with_sepspcpr_lidentidl++str":"++m++str")")letpr_module_binderslpr_c=prlist_strict(pr_module_vardeclspr_c)lletpr_type_optionpr_c=function|{v=CHole(SomeGNamedHole_)}asc->brk(0,2)++str" :"++pr_cc|{v=CHole_}->mt()|_asc->brk(0,2)++str" :"++pr_ccletpr_binders_arg=pr_non_empty_arg@@pr_bindersletpr_and_type_binders_argbl=pr_binders_argblletpr_onescheme(idop,{sch_type;sch_qualid;sch_sort})=letstr_identifier=matchidopwith|Someid->pr_lidentid++str" :="|None->str""inletstr_scheme=matchsch_typewith|SchemeInduction->keyword"Induction for"|SchemeMinimality->keyword"Minimality for"|SchemeElimination->keyword"Elimination for"|SchemeCase->keyword"Case for"inhov0str_identifier++spc()++hov0(str_scheme++spc()++pr_smart_globalsch_qualid)++spc()++hov0(keyword"Sort"++spc()++Sorts.pr_sort_familysch_sort)letpr_equality_scheme_typeschid=letstr_scheme=matchschwith|SchemeBooleanEquality->keyword"Boolean Equality for"|SchemeEquality->keyword"Equality for"inhov0(str_scheme++spc()++pr_smart_globalid)letbegin_of_inductive=function|[]->0|(_,({loc},_))::_->Option.cata(funloc->fst(Loc.unlocloc))0locletpr_class_rawexpr=function|FunClass->keyword"Funclass"|SortClass->keyword"Sortclass"|RefClassqid->pr_smart_globalqidletpr_assumption_tokenmanydischargekind=matchdischarge,kindwith|(NoDischarge,Decls.Logical)->keyword(ifmanythen"Axioms"else"Axiom")|(NoDischarge,Decls.Definitional)->keyword(ifmanythen"Parameters"else"Parameter")|(NoDischarge,Decls.Conjectural)->str"Conjecture"|(DoDischarge,Decls.Logical)->keyword(ifmanythen"Hypotheses"else"Hypothesis")|(DoDischarge,Decls.Definitional)->keyword(ifmanythen"Variables"else"Variable")|(DoDischarge,Decls.Conjectural)->anomaly(Pp.str"Don't know how to beautify a local conjecture.")|(_,Decls.Context)->anomaly(Pp.str"Context is used only internally.")letpr_paramspr_c(xl,(c,t))=hov2(prlist_with_sepseppr_lidentxl++spc()++(ifcthenstr":>"elsestr":"++spc()++pr_ct))letrecfactorize=function|[]->[]|(c,(idl,t))::l->matchfactorizelwith|(xl,((c',t')asr))::l'when(c:bool)==c'&&(=)tt'->(* FIXME: we need equality on constr_expr *)(idl@xl,r)::l'|l'->(idl,(c,t))::l'letpr_ne_params_listpr_cl=matchfactorizelwith|[p]->pr_paramspr_cp|l->prlist_with_sepspc(funp->hov1(str"("++pr_paramspr_cp++str")"))l(*
prlist_with_sep pr_semicolon (pr_params pr_c)
*)letpr_thm_tokenk=keyword(string_of_theorem_kindk)letpr_syntax_modifier=letopenGramlib.GramextinCAst.with_val(function|SetItemLevel(l,bko,n)->prlist_with_sepsep_v2strl++spc()++pr_at_leveln++pr_optpr_constr_as_binder_kindbko|SetItemScope(l,s)->prlist_with_sepsep_v2strl++spc()++str"in scope"++strs|SetLeveln->pr_at_level(NumLeveln)|SetCustomEntry(s,n)->keyword"in"++spc()++keyword"custom"++spc()++strs++(matchnwithNone->mt()|Somen->pr_at_level(NumLeveln))|SetAssocLeftA->keyword"left associativity"|SetAssocRightA->keyword"right associativity"|SetAssocNonA->keyword"no associativity"|SetEntryType(x,typ)->strx++spc()++pr_set_simple_entry_typetyp|SetOnlyPrinting->keyword"only printing"|SetOnlyParsing->keyword"only parsing"|SetFormat(TextFormats)->keyword"format "++pr_astqss)letpr_syntax_modifiers=function|[]->mt()|l->spc()++hov1(str"("++prlist_with_sepsep_v2pr_syntax_modifierl++str")")letpr_notation_declarationntn_decl=letopenVernacexprinlet{ntn_decl_string={CAst.loc;v=ntn};ntn_decl_interp=c;ntn_decl_modifiers=modifiers;ntn_decl_scope=scopt}=ntn_declinqsntn++spc()++str":="++spc()++Flags.without_optionFlags.beautifypr_constrc++pr_syntax_modifiersmodifiers++pr_opt(funsc->spc()++str":"++spc()++strsc)scoptletpr_where_notationdecl_ntn=fnl()++keyword"where "++pr_notation_declarationdecl_ntnletpr_rec_definition{fname;univs;rec_order;binders;rtype;body_def;notations}=letpr_pure_lconstrc=Flags.without_optionFlags.beautifypr_lconstrcinletannot=pr_guard_annotpr_lconstr_exprbindersrec_orderinpr_ident_decl(fname,univs)++pr_binders_argbinders++annot++pr_type_option(func->spc()++pr_lconstr_exprc)rtype++pr_opt(fundef->str":="++brk(1,2)++pr_pure_lconstrdef)body_def++prlistpr_where_notationnotationsletpr_statementhead(idpl,(bl,c))=hov2(head++spc()++pr_ident_declidpl++spc()++(matchblwith[]->mt()|_->pr_bindersbl++spc())++str":"++pr_spc_lconstrc)(**************************************)(* Pretty printer for vernac commands *)(**************************************)letpr_constrargc=spc()++pr_constrcletpr_lconstrargc=spc()++pr_lconstrcletpr_intargn=spc()++intnletpr_vernac_attributes=function|[]->mt()|flags->str"#["++prlist_with_seppr_commaAttributes.pr_vernac_flagflags++str"]"++cut()letpr_occoeins=matchcoe,inswith|NoCoercion,NoInstance->str" :"|AddCoercion,NoInstance->str" :>"|NoCoercion,BackInstance->str" ::"|AddCoercion,BackInstance->str" ::>"|_,BackInstanceWarning->str" :>"(* remove this line at end of deprecation phase *)letpr_record_field(x,{rfu_attrs=attr;rfu_coercion=coe;rfu_instance=ins;rfu_priority=pri;rfu_notation=ntn})=letprx=matchxwith|AssumExpr(id,binders,t)->hov1(pr_vernac_attributesattr++pr_lnameid++pr_binders_argbinders++spc()++pr_occoeins++spc()++pr_lconstr_exprt)|DefExpr(id,binders,b,opt)->(matchoptwith|Somet->hov1(pr_vernac_attributesattr++pr_lnameid++pr_binders_argbinders++spc()++pr_occoeins++spc()++pr_lconstr_exprt++str" :="++pr_lconstrb)|None->hov1(pr_vernac_attributesattr++pr_lnameid++str" :="++spc()++pr_lconstrb))inletprpri=matchpriwithNone->mt()|Somei->str"| "++intiinprx++prpri++prlistpr_where_notationntnletpr_record_declcfsobinder=pr_optpr_lidentc++pr_record"{""}"pr_record_fieldfs++pr_opt(funid->str"as "++pr_lidentid)obinderletpr_printable=function|PrintFullContext->keyword"Print All"|PrintSectionContexts->keyword"Print Section"++spc()++Libnames.pr_qualids|PrintGrammarent->keyword"Print Grammar"++spc()++prlist_with_sepspcstrent|PrintCustomGrammarent->keyword"Print Custom Grammar"++spc()++strent|PrintKeywords->keyword"Print Keywords"|PrintLoadPathdir->keyword"Print LoadPath"++pr_optDirPath.printdir|PrintLibraries->keyword"Print Libraries"|PrintMLLoadPath->keyword"Print ML Path"|PrintMLModules->keyword"Print ML Modules"|PrintDebugGC->keyword"Print ML GC"|PrintGraph->keyword"Print Graph"|PrintClasses->keyword"Print Classes"|PrintTypeclasses->keyword"Print Typeclasses"|PrintInstancesqid->keyword"Print Instances"++spc()++pr_smart_globalqid|PrintCoercions->keyword"Print Coercions"|PrintCoercionPaths(s,t)->keyword"Print Coercion Paths"++spc()++pr_class_rawexprs++spc()++pr_class_rawexprt|PrintCanonicalConversionsqids->keyword"Print Canonical Structures"++prlistpr_smart_globalqids|PrintTypingFlags->keyword"Print Typing Flags"|PrintTables->keyword"Print Tables"|PrintHintGoal->keyword"Print Hint"|PrintHintqid->keyword"Print Hint"++spc()++pr_smart_globalqid|PrintHintDb->keyword"Print Hint *"|PrintHintDbNames->keyword"Print HintDb"++spc()++strs|PrintUniverses(b,g,fopt)->letcmd=ifbthen"Print Sorted Universes"else"Print Universes"inletpr_subgraph=prlist_with_sepspcpr_qualidinkeywordcmd++pr_optpr_subgraphg++pr_optstrfopt|PrintName(qid,udecl)->keyword"Print"++spc()++pr_smart_globalqid++pr_full_univ_name_listudecl|PrintModuleTypeqid->keyword"Print Module Type"++spc()++pr_qualidqid|PrintModuleqid->keyword"Print Module"++spc()++pr_qualidqid|PrintInspectn->keyword"Inspect"++spc()++intn|PrintScopes->keyword"Print Scopes"|PrintScopes->keyword"Print Scope"++spc()++strs|PrintVisibilitys->keyword"Print Visibility"++pr_optstrs|PrintAbout(qid,l,gopt)->pr_opt(fung->Goal_select.pr_goal_selectorg++str":"++spc())gopt++keyword"About"++spc()++pr_smart_globalqid++pr_full_univ_name_listl|PrintImplicitqid->keyword"Print Implicit"++spc()++pr_smart_globalqid(* spiwack: command printing all the axioms and section variables used in a
term *)|PrintAssumptions(b,t,qid)->letcmd=matchb,twith|true,true->"Print All Dependencies"|true,false->"Print Opaque Dependencies"|false,true->"Print Transparent Dependencies"|false,false->"Print Assumptions"inkeywordcmd++spc()++pr_smart_globalqid|PrintNamespacedp->keyword"Print Namespace"++DirPath.printdp|PrintStrategyNone->keyword"Print Strategies"|PrintStrategy(Someqid)->keyword"Print Strategy"++pr_smart_globalqid|PrintRegistered->keyword"Print Registered"|PrintNotation(Constrexpr.InConstrEntry,ntn_key)->keyword"Print Notation"++spc()++strntn_key|PrintNotation(Constrexpr.InCustomEntryent,ntn_key)->keyword"Print Notation"++spc()++strent++strntn_keyletpr_usinge=letrecaux=function|SsEmpty->"()"|SsType->"(Type)"|SsSingl{v=id}->"("^Id.to_stringid^")"|SsComple->"-"^auxe^""|SsUnion(e1,e2)->"("^auxe1^" + "^auxe2^")"|SsSubstr(e1,e2)->"("^auxe1^" - "^auxe2^")"|SsFwdClosee->"("^auxe^")*"inPp.str(auxe)letpr_extendscl=letpr_arga=trypr_genawithFailure_->str"<error in "++strs.ext_entry++str">"intryletrl=Egramml.get_extend_vernac_rulesinletrecauxrlcl=matchrl,clwith|Egramml.GramNonTerminal_::rl,arg::cl->pr_argarg::auxrlcl|Egramml.GramTerminals::rl,cl->strs::auxrlcl|[],[]->[]|_->assertfalseinhov1(pr_sequenceidentity(auxrlcl))withNot_found->hov1(str"TODO("++strs.ext_entry++spc()++prlist_with_sepseppr_argcl++str")")letpr_synpure_vernac_exprv=letreturn=tag_vernacvinmatchvwith(* Proof management *)|VernacAbortAll->return(keyword"Abort All")|VernacRestart->return(keyword"Restart")|VernacUnfocus->return(keyword"Unfocus")|VernacUnfocused->return(keyword"Unfocused")|VernacAbort->return(keyword"Abort")|VernacUndoi->return(ifInt.equali1thenkeyword"Undo"elsekeyword"Undo"++pr_intargi)|VernacUndoToi->return(keyword"Undo"++spc()++keyword"To"++pr_intargi)|VernacFocusi->return(keyword"Focus"++pr_optinti)|VernacShows->letpr_goal_reference=function|OpenSubgoals->mt()|NthGoaln->spc()++intn|GoalIdid->spc()++pr_ididinletpr_showable=function|ShowGoaln->keyword"Show"++pr_goal_referencen|ShowProof->keyword"Show Proof"|ShowExistentials->keyword"Show Existentials"|ShowUniverses->keyword"Show Universes"|ShowProofNames->keyword"Show Conjectures"|ShowIntrosb->keyword"Show "++(ifbthenkeyword"Intros"elsekeyword"Intro")|ShowMatchid->keyword"Show Match "++pr_qualididinreturn(pr_showables)|VernacCheckGuard->return(keyword"Guarded")|VernacValidateProof->return(keyword"Validate Proof")(* Resetting *)|VernacResetNameid->return(keyword"Reset"++spc()++pr_lidentid)|VernacResetInitial->return(keyword"Reset Initial")|VernacBacki->return(ifInt.equali1thenkeyword"Back"elsekeyword"Back"++pr_intargi)(* Syntax *)|VernacOpenCloseScope(opening,sc)->return(keyword(ifopeningthen"Open "else"Close ")++keyword"Scope"++spc()++strsc)|VernacDeclareScopesc->return(keyword"Declare Scope"++spc()++strsc)|VernacDelimiters(sc,Somekey)->return(keyword"Delimit Scope"++spc()++strsc++spc()++keyword"with"++spc()++strkey)|VernacDelimiters(sc,None)->return(keyword"Undelimit Scope"++spc()++strsc)|VernacBindScope(sc,cll)->return(keyword"Bind Scope"++spc()++strsc++spc()++keyword"with"++spc()++prlist_with_sepspcpr_class_rawexprcll)|VernacEnableNotation(on,rule,interp,flags,scope)->letpr_flag=function|EnableNotationEntryCAst.{v=InConstrEntry}->str"in constr"|EnableNotationEntryCAst.{v=InCustomEntrys}->str"in custom "++strs|EnableNotationOnlyOnlyParsing->str"only parsing"|EnableNotationOnlyOnlyPrinting->str"only printing"|EnableNotationOnlyParsingAndPrinting->assertfalse|EnableNotationAll->str"all"inletpr_flags=function|[]->mt()|l->str"("++prlist_with_seppr_commapr_flagl++str")"inletpr_rule=matchrulewith|None->mt()|Some(Inlntn)->quote(strntn)|Some(Inrabbrev)->pr_abbreviationpr_qualidabbrevinletpr_opt_scope=function|None->mt()|Some(NotationInScopes)->spc()++str": "++strs|SomeLastLonelyNotation->str":"++spc()++str"none"inletpp=pr_rule++pr_flagsflags++pr_opt_scopescopeinreturn(keyword(ifonthen"Enable Notation "else"Disable Notation ")++pp)(* Gallina *)|VernacDefinition((discharge,kind),id,b)->(* A verifier... *)letisgoal=Name.is_anonymous(fstid).vinletpr_def_token=keyword(ifisgoalthen"Goal"elsestring_of_definition_object_kindkind)inletpr_reduce=function|None->mt()|Somer->keyword"Eval"++spc()++pr_red_exprr++keyword" in"++spc()inletpr_def_body=matchbwith|DefineBody(bl,red,body,d)->letty=matchdwith|None->mt()|Somety->spc()++str":"++pr_spc_lconstrtyinpr_binders_argbl++ty++str" :="++spc()++pr_reducered++pr_lconstrbody|ProveBody(bl,t)->lettypu=ifisgoalthen(assert(bl=[]);u)else(str" :"++u)inpr_binders_argbl++typ(pr_spc_lconstrt)inreturn(hov2(pr_def_token++(ifisgoalthenmt()elsespc()++pr_lname_declid)++pr_def_body))|VernacStartTheoremProof(ki,l)->return(hov1(pr_statement(pr_thm_tokenki)(List.hdl)++prlist(pr_statement(spc()++keyword"with"))(List.tll)))|VernacEndProofAdmitted->return(keyword"Admitted")|VernacEndProof(Proved(opac,o))->return(matchowith|None->(matchopacwith|Transparent->keyword"Defined"|Opaque->keyword"Qed")|Someid->(ifopac<>Transparentthenkeyword"Save"elsekeyword"Defined")++spc()++pr_lidentid)|VernacExactProofc->return(hov2(keyword"Proof"++pr_lconstrargc))|VernacAssumption((discharge,kind),t,l)->letn=List.length(List.flatten(List.mapfst(List.mapsndl)))inletpr_params(c,(xl,t))=hov2(prlist_with_sepseppr_ident_declxl++spc()++str(matchcwithAddCoercion->":>"|NoCoercion->":")++spc()++pr_lconstr_exprt)inletassumptions=prlist_with_sepspc(funp->hov1(str"("++pr_paramsp++str")"))linreturn(hov2(pr_assumption_token(n>1)dischargekind++pr_non_empty_argpr_assumption_inlinet++spc()++assumptions))|VernacInductive(f,l)->letpr_constructor((attr,coe,ins),(id,c))=hov2(pr_vernac_attributesattr++pr_lidentid++pr_occoeins++Flags.without_optionFlags.beautifypr_spc_lconstrc)inletpr_constructor_listl=matchlwith|Constructors[]->mt()|Constructorsl->letfst_sep=matchlwith[_]->" "|_->" | "inpr_com_at(begin_of_inductivel)++fnl()++strfst_sep++prlist_with_sep(fun_->fnl()++str" | ")pr_constructorl|RecordDecl(c,fs,obinder)->pr_record_declcfsobinderinletpr_oneindkey(((coe,iddecl),(indupar,indpar),s,lc),ntn)=hov0(strkey++spc()++str(matchcoewithAddCoercion->"> "|NoCoercion->"")++pr_cumul_ident_decliddecl++pr_and_type_binders_argindupar++pr_opt(funp->str"|"++spc()++pr_and_type_binders_argp)indpar++pr_opt(funs->str":"++spc()++pr_lconstr_exprs)s++str" :=")++pr_constructor_listlc++prlistpr_where_notationntninletkind=matchfwith|Record->"Record"|Structure->"Structure"|Inductive_kw->"Inductive"|CoInductive->"CoInductive"|Class_->"Class"|Variant->"Variant"inreturn(hov1(pr_oneindkind(List.hdl))++(prlist(funind->fnl()++hov1(pr_oneind"with"ind))(List.tll)))|VernacFixpoint(local,recs)->letlocal=matchlocalwith|DoDischarge->"Let "|NoDischarge->""inreturn(hov0(strlocal++keyword"Fixpoint"++spc()++prlist_with_sep(fun_->fnl()++keyword"with"++spc())pr_rec_definitionrecs))|VernacCoFixpoint(local,corecs)->letlocal=matchlocalwith|DoDischarge->keyword"Let"++spc()|NoDischarge->str""inletpr_onecorec{fname;univs;binders;rtype;body_def;notations}=pr_ident_decl(fname,univs)++spc()++pr_bindersbinders++spc()++str":"++spc()++pr_lconstr_exprrtype++pr_opt(fundef->str":="++brk(1,2)++pr_lconstrdef)body_def++prlistpr_where_notationnotationsinreturn(hov0(local++keyword"CoFixpoint"++spc()++prlist_with_sep(fun_->fnl()++keyword"with"++spc())pr_onecoreccorecs))|VernacSchemel->return(hov2(keyword"Scheme"++spc()++prlist_with_sep(fun_->fnl()++keyword"with"++spc())pr_oneschemel))|VernacSchemeEquality(sch,id)->return(hov2(keyword"Scheme "++pr_equality_scheme_typeschid))|VernacCombinedScheme(id,l)->return(hov2(keyword"Combined Scheme"++spc()++pr_lidentid++spc()++keyword"from"++spc()++prlist_with_sep(fun_->fnl()++str", ")pr_lidentl))|VernacUniversev->return(hov2(keyword"Universe"++spc()++prlist_with_sep(fun_->str",")pr_lidentv))|VernacConstraintv->return(hov2(keyword"Constraint"++spc()++prlist_with_sep(fun_->str",")pr_uconstraintv))(* Gallina extensions *)|VernacNameSectionHypSet(id,set)->return(hov2(keyword"Collection"++spc()++pr_lidentid++spc()++str":="++spc()++pr_usingset))|VernacCanonicalq->return(keyword"Canonical Structure"++spc()++pr_smart_globalq)|VernacCoercion(id,Some(c1,c2))->return(hov1(keyword"Coercion"++spc()++pr_smart_globalid++spc()++str":"++spc()++pr_class_rawexprc1++spc()++str">->"++spc()++pr_class_rawexprc2))|VernacCoercion(id,None)->return(hov1(keyword"Coercion"++spc()++pr_smart_globalid))|VernacIdentityCoercion(id,c1,c2)->return(hov1(keyword"Identity Coercion"++spc()++pr_lidentid++spc()++str":"++spc()++pr_class_rawexprc1++spc()++str">->"++spc()++pr_class_rawexprc2))|VernacInstance(instid,sup,cl,props,info)->return(hov1(keyword"Instance"++(matchinstidwith|{loc;v=Nameid},l->spc()++pr_ident_decl(CAst.(make?locid),l)++spc()|{v=Anonymous},_->mt())++pr_and_type_binders_argsup++str":"++spc()++pr_constrcl++pr_hint_infopr_constr_pattern_exprinfo++(matchpropswith|Some(true,{v=CRecordl})->spc()++str":="++spc()++pr_record_body"{""}"pr_lconstrl|Some(true,_)->assertfalse|Some(false,p)->spc()++str":="++spc()++pr_constrp|None->mt())))|VernacDeclareInstance(instid,sup,cl,info)->return(hov1(keyword"Declare Instance"++spc()++pr_ident_declinstid++spc()++pr_and_type_binders_argsup++str":"++spc()++pr_constrcl++pr_hint_infopr_constr_pattern_exprinfo))|VernacContextl->return(hov1(keyword"Context"++pr_and_type_binders_argl))|VernacExistingInstanceinsts->letpr_inst(id,info)=pr_qualidid++pr_hint_infopr_constr_pattern_exprinfoinreturn(hov1(keyword"Existing"++spc()++keyword(String.plural(List.lengthinsts)"Instance")++spc()++prlist_with_sepspcpr_instinsts))|VernacExistingClassid->return(hov1(keyword"Existing"++spc()++keyword"Class"++spc()++pr_qualidid))(* Commands *)|VernacCreateHintDb(dbname,b)->return(hov1(keyword"Create HintDb"++spc()++strdbname++(ifbthenstr" discriminated"elsemt())))|VernacRemoveHints(dbnames,ids)->return(hov1(keyword"Remove Hints"++spc()++prlist_with_sepspc(funr->pr_qualidr)ids++pr_opt_hintbasesdbnames))|VernacHints(dbnames,h)->return(pr_hintsdbnameshpr_constrpr_constr_pattern_expr)|VernacSyntacticDefinition(id,(ids,c),l)->return(hov2(keyword"Notation"++spc()++pr_abbreviationpr_lident(ids,id)++str":="++pr_constrargc++pr_syntax_modifiersl))|VernacArguments(q,args,more_implicits,mods)->return(hov2(keyword"Arguments"++spc()++pr_smart_globalq++letpr_s=prlist(fun{v=s}->pr_scope_delimiters)inletpr_ifbx=ifbthenxelsestr""inletpr_one_arg(x,k)=pr_ifk(str"!")++Name.printxinletpr_brimpforcex=letleft,right=matchimpwith|Glob_term.NonMaxImplicit->str"[",str"]"|Glob_term.MaxImplicit->str"{",str"}"|Glob_term.Explicit->ifforcethenstr"(",str")"elsemt(),mt()inleft++x++rightinletget_arguments_likesimptl=ifs=[]&&imp=Glob_term.Explicitthen[],tlelseletrecfoldextra=function|RealArgarg::tlwhenList.equal(funab->letda,a=a.CAst.vinletdb,b=b.CAst.vinda=db&&String.equalab)arg.notation_scopes&&arg.implicit_status=imp->fold((arg.name,arg.recarg_like)::extra)tl|args->List.revextra,argsinfold[]tlinletrecprint_arguments=function|[]->mt()|VolatileArg::l->spc()++str"/"++print_argumentsl|BidiArg::l->spc()++str"&"++print_argumentsl|RealArg{name=id;recarg_like=k;notation_scope=s;implicit_status=imp}::tl->letextra,tl=get_arguments_likesimptlinspc()++hov1(pr_brimp(extra<>[])(prlist_with_sepspcpr_one_arg((id,k)::extra))++pr_ss)++print_argumentstlinletrecprint_implicits=function|[]->mt()|(name,impl)::rest->spc()++pr_brimplfalse(Name.printname)++print_implicitsrestinprint_argumentsargs++ifnot(List.is_emptymore_implicits)thenprlist(funl->str","++print_implicitsl)more_implicitselse(mt())++(ifnot(List.is_emptymods)thenstr" : "elsestr"")++prlist_with_sep(fun()->str", "++spc())(function|`ReductionDontExposeCase->keyword"simpl nomatch"|`ReductionNeverUnfold->keyword"simpl never"|`DefaultImplicits->keyword"default implicits"|`Rename->keyword"rename"|`Assert->keyword"assert"|`ExtraScopes->keyword"extra scopes"|`ClearImplicits->keyword"clear implicits"|`ClearScopes->keyword"clear scopes"|`ClearBidiHint->keyword"clear bidirectionality hint")mods))|VernacReservebl->letn=List.length(List.flatten(List.mapfstbl))inreturn(hov2(tag_keyword(str"Implicit Type"++str(ifn>1then"s "else" "))++pr_ne_params_listpr_lconstr_expr(List.map(funsb->false,sb)bl)))|VernacGeneralizableg->return(hov1(tag_keyword(str"Generalizable Variable"++matchgwith|None->str"s none"|Some[]->str"s all"|Someidl->str(ifList.lengthidl>1then"s "else" ")++prlist_with_sepspcpr_lidentidl)))|VernacSetOpacity(k,l)whenConv_oracle.is_transparentk->return(hov1(keyword"Transparent"++spc()++prlist_with_sepseppr_smart_globall))|VernacSetOpacity(Conv_oracle.Opaque,l)->return(hov1(keyword"Opaque"++spc()++prlist_with_sepseppr_smart_globall))|VernacSetOpacity_->return(CErrors.anomaly(keyword"VernacSetOpacity used to set something else."))|VernacSetStrategyl->letpr_lev=function|Conv_oracle.Opaque->keyword"opaque"|Conv_oracle.Expand->keyword"expand"|lwhenConv_oracle.is_transparentl->keyword"transparent"|Conv_oracle.Leveln->intninletpr_line(l,q)=hov2(pr_levl++spc()++str"["++prlist_with_sepseppr_smart_globalq++str"]")inreturn(hov1(keyword"Strategy"++spc()++hv0(prlist_with_sepseppr_linel)))|VernacAddOption(na,l)->return(hov2(keyword"Add"++spc()++pr_printoptionna(Somel)))|VernacRemoveOption(na,l)->return(hov2(keyword"Remove"++spc()++pr_printoptionna(Somel)))|VernacMemOption(na,l)->return(hov2(keyword"Test"++spc()++pr_printoptionna(Somel)))|VernacPrintOptionna->return(hov2(keyword"Test"++spc()++pr_printoptionnaNone))|VernacCheckMayEval(r,io,c)->letpr_mayevalrc=matchrwith|Somer0->hov2(keyword"Eval"++spc()++pr_red_exprr0++spc()++keyword"in"++spc()++pr_lconstrc)|None->hov2(keyword"Check"++spc()++pr_lconstrc)inletpr_i=matchiowithNone->mt()|Somei->Goal_select.pr_goal_selectori++str": "inreturn(pr_i++pr_mayevalrc)|VernacGlobalCheckc->return(hov2(keyword"Type"++pr_constrargc))|VernacDeclareReduction(s,r)->return(keyword"Declare Reduction"++spc()++strs++str" := "++pr_red_exprr)|VernacPrintp->return(pr_printablep)|VernacSearch(sea,g,sea_r)->return(pr_searchseagsea_r@@pr_constr_pattern_expr)|VernacLocateloc->letpr_locate=function|LocateAnyqid->pr_smart_globalqid|LocateTermqid->keyword"Term"++spc()++pr_smart_globalqid|LocateFilef->keyword"File"++spc()++qsf|LocateLibraryqid->keyword"Library"++spc()++pr_moduleqid|LocateModuleqid->keyword"Module"++spc()++pr_moduleqid|LocateOther(s,qid)->keywords++spc()++pr_ltac_refqidinreturn(keyword"Locate"++spc()++pr_locateloc)|VernacRegister(qid,RegisterCoqlibname)->return(hov2(keyword"Register"++spc()++pr_qualidqid++spc()++str"as"++spc()++pr_qualidname))|VernacRegister(qid,RegisterInline)->return(hov2(keyword"Register Inline"++spc()++pr_qualidqid))|VernacPrimitive(id,r,typopt)->hov2(keyword"Primitive"++spc()++pr_ident_declid++(Option.cata(funty->spc()++str":"++pr_spc_lconstrty)(mt())typopt)++spc()++str":="++spc()++str(CPrimitives.op_or_type_to_stringr))|VernacCommentsl->return(hov2(keyword"Comments"++spc()++prlist_with_sepsep(pr_commentpr_constr)l))|VernacAttributesattrs->return(hov2(keyword"Attributes"++spc()++pr_vernac_attributesattrs))|VernacProof(None,None)->return(keyword"Proof")|VernacProof(None,Somee)->return(keyword"Proof "++spc()++keyword"using"++spc()++pr_usinge)|VernacProof(Somete,None)->return(keyword"Proof with"++spc()++pr_gente)|VernacProof(Somete,Somee)->return(keyword"Proof"++spc()++keyword"using"++spc()++pr_usinge++spc()++keyword"with"++spc()++pr_gente)|VernacBulletb->(* XXX: Redundant with Proof_bullet.print *)return(letopenProof_bulletinbeginmatchbwith|Dashn->str(String.maken'-')|Starn->str(String.maken'*')|Plusn->str(String.maken'+')end)|VernacSubproofNone->return(str"{")|VernacSubproof(Somei)->return(Goal_select.pr_goal_selectori++str":"++spc()++str"{")|VernacEndSubproof->return(str"}")letpr_synterp_vernac_exprv=letreturn=tag_vernacvinmatchvwith|VernacLoad(f,s)->return(keyword"Load"++iffthen(spc()++keyword"Verbose"++spc())elsespc()++qss)|VernacBeginSectionid->return(hov2(keyword"Section"++spc()++pr_lidentid))|VernacEndSegmentid->return(hov2(keyword"End"++spc()++pr_lidentid))|VernacNotation(infix,ntn_decl)->return(hov2(hov0(keyword(ifinfixthen"Infix"else"Notation")++spc()++pr_notation_declarationntn_decl)))|VernacReservedNotation(_,(s,l))->return(keyword"Reserved Notation"++spc()++pr_astqss++pr_syntax_modifiersl)|VernacDeclareCustomEntrys->return(keyword"Declare Custom Entry "++strs)|VernacRequire(from,exp,l)->letfrom=matchfromwith|None->mt()|Somer->keyword"From"++spc()++pr_moduler++spc()inreturn(hov2(from++keyword"Require"++spc()++pr_require_tokenexp++prlist_with_sepseppr_import_modulel))|VernacImport(f,l)->return(pr_export_with_catsf++spc()++prlist_with_sepseppr_import_modulel)(* Modules and Module Types *)|VernacDefineModule(export,m,bl,tys,bd)->letb=pr_module_bindersblpr_lconstrinreturn(hov2(keyword"Module"++spc()++pr_require_tokenexport++pr_lidentm++b++pr_of_module_typepr_lconstrtys++(ifList.is_emptybdthenmt()elsestr":= ")++prlist_with_sep(fun()->str" <+")(pr_module_ast_inltruepr_lconstr)bd))|VernacDeclareModule(export,id,bl,m1)->letb=pr_module_bindersblpr_lconstrinreturn(hov2(keyword"Declare Module"++spc()++pr_require_tokenexport++pr_lidentid++b++str" :"++pr_module_ast_inltruepr_lconstrm1))|VernacDeclareModuleType(id,bl,tyl,m)->letb=pr_module_bindersblpr_lconstrinletpr_mt=pr_module_ast_inltruepr_lconstrinreturn(hov2(keyword"Module Type "++pr_lidentid++b++prlist_strict(funm->str" <:"++pr_mtm)tyl++(ifList.is_emptymthenmt()elsestr":= ")++prlist_with_sep(fun()->str" <+ ")pr_mtm))|VernacInclude(mexprs)->letpr_m=pr_module_ast_inlfalsepr_lconstrinreturn(hov2(keyword"Include"++spc()++prlist_with_sep(fun()->str" <+ ")pr_mmexprs))(* Auxiliary file and library management *)|VernacDeclareMLModule(l)->return(hov2(keyword"Declare ML Module"++spc()++prlist_with_sepsepqsl))|VernacChdirs->return(keyword"Cd"++pr_optqss)|VernacSetOption(export,na,v)->letexport=ifexportthenkeyword"Export"++spc()elsemt()inletset=ifv==OptionUnsetthen"Unset"else"Set"inreturn(hov2(export++keywordset++spc()++pr_set_optionnav))|VernacExtraDependency(from,file,id)->return(hov2(keyword"From"++spc()++pr_modulefrom++spc()++keyword"Extra"++spc()++keyword"Dependency"++spc()++qsfile++pr_opt(funx->spc()++keyword"as"++spc()++pr_idx)id))|VernacExtend(s,c)->return(pr_extendsc)|VernacProofModes->return(keyword"Proof Mode"++strs)letpr_control_flag(p:control_flag)=letw=matchpwith|ControlTime->keyword"Time"|ControlInstructions->keyword"Instructions"|ControlRedirects->keyword"Redirect"++spc()++qss|ControlTimeoutn->keyword"Timeout "++intn|ControlFail->keyword"Fail"|ControlSucceed->keyword"Succeed"inw++spc()letpr_vernac_controlflags=Pp.prlistpr_control_flagflagsletpr_vernac_exprv=matchvwith|VernacSynPuree->pr_synpure_vernac_expre|VernacSynterpe->pr_synterp_vernac_expreletpr_vernac({v={control;attrs;expr}}asv)=tag_vernacv(pr_vernac_controlcontrol++pr_vernac_attributesattrs++pr_vernac_exprexpr++sep_endexpr)