1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378(************************************************************************)(* * 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) *)(************************************************************************)openPpopenNamesopenCErrorsopenUtilopenCAstopenExtendopenConstrexpropenConstrexpr_opsopenVernacexpropenDeclaremodsopenPputilsopenPpconstrletdo_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_univ_name_list=function|None->mt()|Somel->str"@{"++prlist_with_sepspcpr_lnamel++str"}"letpr_variance_lident(lid,v)=letv=Option.cataUniv.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()->str",")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|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"|AsNameOrPattern->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_search_item=function|SearchSubPattern(where,p)->pr_search_wherewhere++pr_constr_pattern_exprp|SearchString(where,s,sc)->pr_search_wherewhere++qss++pr_opt(funsc->str"%"++strsc)sc|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(k,Namegen.IntroAnonymous,_)}->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_decl_notationprcdecl_ntn=letopenVernacexprinlet{decl_ntn_string={CAst.loc;v=ntn};decl_ntn_interp=c;decl_ntn_modifiers=modifiers;decl_ntn_scope=scopt}=decl_ntninfnl()++keyword"where "++qsntn++str" := "++Flags.without_optionFlags.beautifyprcc++pr_syntax_modifiersmodifiers++pr_opt(funsc->str": "++strsc)scoptletpr_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++prlist(pr_decl_notation@@pr_constr)notationsletpr_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_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,{rf_coercion=coe;rf_instance=ins;rf_priority=pri;rf_notation=ntn})=letprx=matchxwith|AssumExpr(id,binders,t)->hov1(pr_lnameid++pr_binders_argbinders++spc()++pr_occoeins++spc()++pr_lconstr_exprt)|DefExpr(id,binders,b,opt)->(matchoptwith|Somet->hov1(pr_lnameid++pr_binders_argbinders++spc()++pr_occoeins++spc()++pr_lconstr_exprt++str" :="++pr_lconstrb)|None->hov1(pr_lnameid++str" :="++spc()++pr_lconstrb))inletprpri=matchpriwithNone->mt()|Somei->str"| "++intiinprx++prpri++prlist(pr_decl_notation@@pr_constr)ntnletpr_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_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_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 "++str(fsts)++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("++str(fsts)++spc()++prlist_with_sepseppr_argcl++str")")letpr_vernac_exprv=letreturn=tag_vernacvinmatchvwith|VernacLoad(f,s)->return(keyword"Load"++iffthen(spc()++keyword"Verbose"++spc())elsespc()++qss)(* 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")(* 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)|VernacNotation(infix,c,({v=s},l),opt)->return(hov2(hov0(keyword(ifinfixthen"Infix"else"Notation")++spc()++qss++str" :="++Flags.without_optionFlags.beautifypr_constrargc)++pr_syntax_modifiersl++(matchoptwith|None->mt()|Somesc->spc()++str":"++spc()++strsc)))|VernacReservedNotation(_,(s,l))->return(keyword"Reserved Notation"++spc()++pr_astqss++pr_syntax_modifiersl)|VernacDeclareCustomEntrys->return(keyword"Declare Custom Entry "++strs)|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... *)letpr_def_tokendk=keyword(ifName.is_anonymous(fstid).vthen"Goal"elsestring_of_definition_object_kinddk)inletpr_reduce=function|None->mt()|Somer->keyword"Eval"++spc()++pr_red_exprr++keyword" in"++spc()inletpr_def_body=function|DefineBody(bl,red,body,d)->letty=matchdwith|None->mt()|Somety->spc()++str":"++pr_spc_lconstrtyin(pr_binders_argbl,ty,Some(pr_reducered++pr_lconstrbody))|ProveBody(bl,t)->lettypu=if(fstid).v=Anonymousthen(assert(bl=[]);u)else(str" :"++u)in(pr_binders_argbl,typ(pr_spc_lconstrt),None)inlet(binds,typ,c)=pr_def_bodybinreturn(hov2(pr_def_tokenkind++spc()++pr_lname_declid++binds++typ++(matchcwith|None->mt()|Somecc->str" :="++spc()++cc)))|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((coe,ins),(id,c))=hov2(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++prlist(pr_decl_notation@@pr_constr)ntninletkind=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++prlist(pr_decl_notation@@pr_constr)notationsinreturn(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 *)|VernacBeginSectionid->return(hov2(keyword"Section"++spc()++pr_lidentid))|VernacEndSegmentid->return(hov2(keyword"End"++spc()++pr_lidentid))|VernacNameSectionHypSet(id,set)->return(hov2(keyword"Collection"++spc()++pr_lidentid++spc()++str":="++spc()++pr_usingset))|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))|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)|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))(* 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 *)|VernacAddLoadPath{implicit;physical_path;logical_path}->return(hov2(keyword"Add"++(ifimplicitthenspc()++keyword"Rec"++spc()elsespc())++keyword"LoadPath"++spc()++qsphysical_path++spc()++keyword"as"++spc()++DirPath.printlogical_path))|VernacRemoveLoadPaths->return(keyword"Remove LoadPath"++qss)|VernacAddMLPath(s)->return(keyword"Add"++keyword"ML Path"++qss)|VernacDeclareMLModule(l)->return(hov2(keyword"Declare ML Module"++spc()++prlist_with_sepsepqsl))|VernacChdirs->return(keyword"Cd"++pr_optqss)(* 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_id(coerce_reference_to_idr))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}->str"%"++strs)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->String.equala.CAst.vb.CAst.v)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)))|VernacSetOption(export,na,v)->letexport=ifexportthenkeyword"Export"++spc()elsemt()inletset=ifv==OptionUnsetthen"Unset"else"Set"inreturn(hov2(export++keywordset++spc()++pr_set_optionnav))|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))(* For extension *)|VernacExtend(s,c)->return(pr_extendsc)|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)|VernacProofModes->return(keyword"Proof Mode"++strs)|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_control_flag(p:control_flag)=letw=matchpwith|ControlTime_->keyword"Time"|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_attributes=function|[]->mt()|flags->str"#["++prlist_with_seppr_commaAttributes.pr_vernac_flagflags++str"]"++cut()letpr_vernac({v={control;attrs;expr}}asv)=tag_vernacv(pr_vernac_controlcontrol++pr_vernac_attributesattrs++pr_vernac_exprexpr++sep_endexpr)