123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779(************************************************************************)(* * 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) *)(************************************************************************)(*i*)openCErrorsopenUtilopenPpopenCAstopenNamesopenLibnamesopenPputilsopenPpextendopenGlob_termopenConstrexpropenConstrexpr_opsopenNamegen(*i*)moduleTag=structletkeyword="constr.keyword"letevar="constr.evar"letuniv="constr.type"letnotation="constr.notation"letvariable="constr.variable"letreference="constr.reference"letpath="constr.path"endletdo_not_tag_x=xlettagts=Pp.tagtslettag_keyword=tagTag.keywordlettag_evar=tagTag.evarlettag_type=tagTag.univlettag_unparsing=function|UnpTerminals->tagTag.notation|_->do_not_tag()lettag_constr_expr=do_not_taglettag_path=tagTag.pathlettag_ref=tagTag.referencelettag_var=tagTag.variableletkeywords=tag_keyword(strs)letsep_v=fun_->str","++spc()letpr_tight_coma()=str","++cut()letlatom=0letlprod=200letllambda=200letlif=200letlletin=200letlletpattern=200letlfix=200letlcast=100letlarg=9letlapp=10letlposint=0letlnegint=35(* must be consistent with Notation "- x" *)letltop=LevelLe200letlproj=1letldelim=1letlsimpleconstr=LevelLe8letlsimplepatt=LevelLe1letprec_lesschild=function|LevelLtparent->(<)childparent|LevelLeparent->ifparent<0&&Int.equalchildlprodthentrueelsechild<=absparent|LevelSome->trueletprec_of_prim_token=function|Number(NumTok.SPlus,_)->lposint|Number(NumTok.SMinus,_)->lnegint|String_->latomletprint_hunksnprpr_pattpr_binders(terms,termlists,binders,binderlists)unps=letenv=reftermsandenvlist=reftermlistsandbl=refbindersandbll=refbinderlistsinletpopr=leta=List.hd!rinr:=List.tl!r;ainletreturnunppp1pp2=(tag_unparsingunppp1)++pp2inletparens=!Constrextern.print_parenthesesin(* Warning:
The following function enforces a very precise order of
evaluation of sub-components.
Do not modify it unless you know what you are doing! *)letrecaux=function|[]->mt()|UnpMetaVar(prec,side)asunp::l->letc=popenvinletpp2=auxlinletpp1=pr(ifparens&&side<>NonethenLevelLe0elseprec)cinreturnunppp1pp2|UnpBinderMetaVar(prec,style)asunp::l->letc,bk=popblinletpp2=auxlinletpp1=pr_pattprecstylebkcinreturnunppp1pp2|UnpListMetaVar(prec,sl,side)asunp::l->letcl=popenvlistinletpp1=prlist_with_sep(fun()->auxsl)(pr(ifparens&&side<>NonethenLevelLe0elseprec))clinletpp2=auxlinreturnunppp1pp2|UnpBinderListMetaVar(isopen,withquote,sl)asunp::l->letcl=popbllinletpp2=auxlinletpp1=pr_binders(fun()->auxsl)isopenwithquoteclinreturnunppp1pp2|UnpTerminalsasunp::l->letpp2=auxlinletpp1=strsinreturnunppp1pp2|UnpBox(b,sub)asunp::l->letpp1=ppcmd_of_boxb(aux(List.mapsndsub))inletpp2=auxlinreturnunppp1pp2|UnpCutcutasunp::l->letpp2=auxlinletpp1=ppcmd_of_cutcutinreturnunppp1pp2inauxunpsletpr_notationprpr_pattpr_binderswhichsenv=let{notation_printing_unparsing=unpl;notation_printing_level=level}=find_notation_printing_rulewhichsinprint_hunkslevelprpr_pattpr_bindersenvunpl,levelletpr_delimiterskeystrm=strm++str("%"^key)letpr_generalizationbkc=lethd,tl=matchbkwith|NonMaxImplicit->"[","]"|MaxImplicit->"{","}"|Explicit->"(",")"in(* TODO: syntax Abstraction Kind *)str"`"++strhd++c++strtlletpr_com_atn=if!Flags.beautify&¬(Int.equaln0)thencomment(Pputils.extract_commentsn)elsemt()letpr_with_comments?locpp=pr_located(funx->x)(loc,pp)letpr_sep_comsepfc=pr_with_comments?loc:(constr_locc)(sep()++fc)letpr_sort_name_expr=function|CSProp->str"SProp"|CProp->str"Prop"|CSet->str"Set"|CTypeqid->pr_qualidqid|CRawTypes->Univ.Level.raw_prsletpr_univ_expr(u,n)=pr_sort_name_expru++(matchnwith0->mt()|_->str"+"++intn)letpr_univl=matchlwith|[x]->pr_univ_exprx|l->str"max("++prlist_with_sep(fun()->str",")pr_univ_exprl++str")"letpr_quality_univ(q,l)=matchqwith|None->pr_univl|Someq->str"(* "++Sorts.QVar.prq++str" *)"++spc()++pr_univlletpr_univ_annotprx=str"@{"++prx++str"}"letpr_sort_expr=function|UNamed(None,[CSProp,0])->tag_type(str"SProp")|UNamed(None,[CProp,0])->tag_type(str"Prop")|UNamed(None,[CSet,0])->tag_type(str"Set")|UAnonymous{rigid=true}->tag_type(str"Type")|UAnonymous{rigid=false}->tag_type(str"Type")++pr_univ_annot(fun_->str"_")()|UNamedu->hov0(tag_type(str"Type")++pr_univ_annotpr_quality_univu)letpr_univ_level_expr=function|UNamedCSProp->tag_type(str"SProp")|UNamedCProp->tag_type(str"Prop")|UNamedCSet->tag_type(str"Set")|UAnonymous{rigid=true}->tag_type(str"Type")|UAnonymous{rigid=false}->tag_type(str"_")|UNamed(CTypeu)->tag_type(pr_qualidu)|UNamed(CRawTypes)->tag_type(Univ.Level.raw_prs)letpr_qualidsp=let(sl,id)=repr_qualidspinletid=tag_ref(Id.printid)inletsl=matchList.rev(DirPath.reprsl)with|[]->mt()|sl->letprdir=tag_path(Id.printdir)++str"."inprlistprslinsl++idletpr_id=Id.printletpr_qualid=pr_qualidletpr_patvar=pr_idletpr_universe_instancel=pr_opt_no_spc(pr_univ_annot(prlist_with_sepspcpr_univ_level_expr))lletpr_referenceqid=ifqualid_is_identqidthentag_var(pr_id@@qualid_basenameqid)elsepr_qualidqidletpr_crefrefus=pr_referenceref++pr_universe_instanceusletpr_expl_argspr(a,expl)=matchexplwith|None->pr(LevelLtlapp)a|Some{v=pos}->letpr_pos=function|ExplByNameid->pr_idid|ExplByPosp->intpinstr"("++pr_pospos++str":="++prltopa++str")"letpr_opt_type_spcpr=function|{CAst.v=CHole(_,IntroAnonymous)}->mt()|t->str" :"++pr_sep_com(fun()->brk(1,4))(prltop)tletpr_prim_token=function|Numbern->NumTok.Signed.printn|Strings->qssletpr_evarpridl=hov0(tag_evar(str"?"++pr_lidentid)++(matchlwith|[]->mt()|l->letf(id,c)=pr_lidentid++str":="++prltopcinstr"@{"++hov0(prlist_with_seppr_semicolonf(List.revl))++str"}"))(* Assuming "{" and "}" brackets, prints
- if there is enough room
{ a; b; c }
- otherwise
{
a;
b;
c
}
Alternatively, replace outer hv with h to get instead:
{ a;
b;
c }
Replace the inner hv with hov to respectively get instead (if enough room):
{
a; b;
c
}
or
{ a; b;
c }
*)letpr_recordleftrightpr=function|[]->strleft++str" "++strright|l->hv0(strleft++brk(1,String.lengthleft)++hv0(prlist_with_seppr_semicolonprl)++brk(1,0)++strright)letpr_record_bodyleftrightprl=letpr_defined_field(id,c)=hov2(pr_referenceid++str" :="++prc)inpr_recordleftrightpr_defined_fieldlletlas=lappletlpator=0letlpatrec=0letlpatcast=LevelLe100letlpattop=LevelLe200letrecpr_pattsepprinhp=let(strm,prec)=matchCAst.(p.v)with|CPatRecordl->pr_record_body"{|""|}"(pr_pattspcprlpattop)l,lpatrec|CPatAlias(p,na)->pr_pattmtpr(LevelLelas)p++str" as "++pr_lnamena,las|CPatCstr(c,None,[])->pr_referencec,latom|CPatCstr(c,None,args)->pr_referencec++prlist(pr_pattspcpr(LevelLtlapp))args,lapp|CPatCstr(c,Someargs,[])->str"@"++pr_referencec++prlist(pr_pattspcpr(LevelLtlapp))args,lapp|CPatCstr(c,Someexpl_args,extra_args)->surround(str"@"++pr_referencec++prlist(pr_pattspcpr(LevelLtlapp))expl_args)++prlist(pr_pattspcpr(LevelLtlapp))extra_args,lapp|CPatAtom(None)->str"_",latom|CPatAtom(Somer)->pr_referencer,latom|CPatOrpl->letppp=hov0(pr_pattmtprlpattopp)insurround(hov0(prlist_with_seppr_spcbarpppl)),lpator|CPatNotation(_,(_,"( _ )"),([p],[]),[])->pr_patt(fun()->str"(")prlpattopp++str")",latom|CPatNotation(which,s,(l,ll),args)->letstrm_not,l_not=pr_notation(pr_pattmtpr)(fun____->mt())(fun____->mt())whichs(l,ll,[],[])in(ifList.is_emptyargs||prec_lessl_not(LevelLtlapp)thenstrm_notelsesurroundstrm_not)++prlist(pr_pattspcpr(LevelLtlapp))args,ifnot(List.is_emptyargs)thenlappelsel_not|CPatPrimp->pr_prim_tokenp,latom|CPatDelimiters(k,p)->pr_delimitersk(pr_pattmtprlsimplepattp),1|CPatCast(p,t)->(pr_pattmtprlpatcastp++spc()++str":"++ws1++prt),1inletloc=p.CAst.locinpr_with_comments?loc(sep()++ifprec_lessprecinhthenstrmelsesurroundstrm)letpr_patt=pr_pattmtletpr_patt_binderprprecstylebkc=matchbkwith|MaxImplicit->str"{"++pr_pattprlpattopc++str"}"|NonMaxImplicit->str"["++pr_pattprlpattopc++str"]"|Explicit->matchstyle,cwith|NotQuotedPattern,_|_,{v=CPatAtom_}->pr_pattprprecc|QuotedPattern,_->str"'"++pr_pattprpreccletpr_eqnpr{loc;v=(pl,rhs)}=spc()++hov4(pr_with_comments?loc(str"| "++hov0(prlist_with_seppr_spcbar(funp->hov0(prlist_with_sepsep_v(pr_patt(prltop)ltop)p))pl++str" =>")++pr_sep_comspc(prltop)rhs))letbegin_of_binderl_bi=letb_locl=fst(Option.cataLoc.unloc(0,0)l)inmatchl_biwith|CLocalDef({loc},_,_)->b_locloc|CLocalAssum({loc}::_,_,_)->b_locloc|CLocalPattern{loc}->b_locloc|_->assertfalseletbegin_of_binders=function|b::_->begin_of_binderb|_->0letsurround_implkp=matchkwith|Explicit->str"("++p++str")"|NonMaxImplicit->str"["++p++str"]"|MaxImplicit->str"{"++p++str"}"letsurround_implicitkp=matchkwith|Explicit->p|NonMaxImplicit->str"["++p++str"]"|MaxImplicit->(str"{"++p++str"}")letpr_bindermanypr(nal,k,t)=matchkwith|Generalized(b',t')->beginmatchnalwith|[{loc;v=Anonymous}]->hov1(str"`"++(surround_implb'((ift'thenstr"!"elsemt())++prt)))|[{loc;v=Nameid}]->hov1(str"`"++(surround_implb'(pr_lidentCAst.(make?locid)++str" : "++(ift'thenstr"!"elsemt())++prt)))|_->anomaly(Pp.str"List of generalized binders have always one element.")end|Defaultb->matchtwith|{CAst.v=CHole(_,IntroAnonymous)}->lets=prlist_with_sepspcpr_lnamenalinhov1(surround_implicitbs)|_->lets=prlist_with_sepspcpr_lnamenal++str" : "++prtinhov1(ifmanythensurround_implbselsesurround_implicitbs)letpr_binder_among_manywithquotepr_c=function|CLocalAssum(nal,k,t)->pr_bindertruepr_c(nal,k,t)|CLocalDef(na,c,topt)->surround(pr_lnamena++pr_opt_no_spc(funt->str" :"++ws1++pr_ct)topt++str" :="++spc()++pr_cc)|CLocalPatternp->str(ifwithquotethen"'"else"")++pr_pattpr_clsimplepattpletpr_undelimited_binderssepwithquotepr_c=prlist_with_sepsep(pr_binder_among_manywithquotepr_c)letpr_delimited_binderskwsepwithquotepr_cbl=letn=begin_of_bindersblinmatchblwith|[CLocalAssum(nal,k,t)]->kwn++pr_binderfalsepr_c(nal,k,t)|(CLocalAssum_|CLocalPattern_|CLocalDef_)::_asbdl->kwn++pr_undelimited_binderssepwithquotepr_cbdl|[]->anomaly(Pp.str"The ast is malformed, found lambda/prod without proper binders.")letpr_binders_genpr_csepis_openwithquote=ifis_openthenpr_delimited_binderspr_com_atsepwithquotepr_celsepr_undelimited_binderssepwithquotepr_cletpr_recursive_declprpr_danglingkwdangling_with_foridblannottc=letpr_body=ifdangling_with_forthenpr_danglingelseprinhov0(strkw++brk(1,2)++pr_idid++(ifbl=[]thenmt()elsebrk(1,2))++hov0(pr_undelimited_bindersspctrue(prltop)bl++annot)++pr_opt_type_spcprt++str" :=")++pr_sep_com(fun()->brk(1,2))(pr_bodyltop)cletpr_guard_annotpr_auxblro=matchrowith|None->mt()|Some{loc;v=ro}->matchrowith|CStructRec{v=id}->letnames_of_binder=function|CLocalAssum(nal,_,_)->nal|CLocalDef(_,_,_)->[]|CLocalPattern_->assertfalseinletids=List.flatten(List.mapnames_of_binderbl)inifList.lengthids>1thenspc()++str"{"++keyword"struct"++brk(1,1)++pr_idid++str"}"elsemt()|CWfRec(id,c)->spc()++str"{"++keyword"wf"++brk(1,1)++pr_auxc++brk(1,1)++pr_lidentid++str"}"|CMeasureRec(id,m,r)->spc()++str"{"++keyword"measure"++brk(1,1)++pr_auxm++matchidwithNone->mt()|Someid->brk(1,1)++pr_lidentid++(matchrwithNone->mt()|Somer->str" on "++pr_auxr)++str"}"letpr_fixdeclprprdkwdangling_with_for({v=id},ro,bl,t,c)=letannot=pr_guard_annot(prlsimpleconstr)blroinpr_recursive_declprprdkwdangling_with_foridblannottcletpr_cofixdeclprprdkwdangling_with_for({v=id},bl,t,c)=pr_recursive_declprprdkwdangling_with_foridbl(mt())tcletpr_recursivekwpr_declid=function|[]->anomaly(Pp.str"(co)fixpoint with no definition.")|[d1]->pr_declkwfalsed1|d1::dl->pr_declkwtrued1++fnl()++prlist_with_sep(fun()->fnl())(pr_decl"with"true)dl++fnl()++keyword"for"++spc()++pr_ididletpr_as_inprnaindnalopt=(matchnawith(* Decision of printing "_" or not moved to constrextern.ml *)|Somena->spc()++keyword"as"++spc()++pr_lnamena|None->mt())++(matchindnaloptwith|None->mt()|Somet->spc()++keyword"in"++spc()++pr_pattprlsimplepattt)letpr_case_itempr(tm,as_clause,in_clause)=hov0(pr(LevelLelcast)tm++pr_as_in(prltop)as_clausein_clause)letpr_case_typeprpo=matchpowith|None|Some{CAst.v=CHole(_,IntroAnonymous)}->mt()|Somep->spc()++hov2(keyword"return"++pr_sep_comspc(prlsimpleconstr)p)letpr_simple_return_typeprnapo=(matchnawith|Some{v=Nameid}->spc()++keyword"as"++spc()++pr_idid|_->mt())++pr_case_typeprpoletpr_projprpr_appafl=hov0(pr(LevelLelproj)a++cut()++str".("++pr_appprfl++str")")letpr_appexplpr(f,us)l=hov2(str"@"++pr_referencef++pr_universe_instanceus++prlist(pr_sep_comspc(pr(LevelLtlapp)))l)letpr_apppral=hov2(pr(LevelLtlapp)a++prlist(funa->spc()++pr_expl_argspra)l)letpr_foralln=keyword"forall"++pr_com_atn++spc()letpr_funn=keyword"fun"++pr_com_atn++spc()letpr_fun_sep=spc()++str"=>"letpr_dangling_with_forsepprinheriteda=matcha.vwith|(CFix(_,[_])|CCoFix(_,[_]))->prsep(LevelLelatom)a|_->prsepinheritedaletpr_cast=letopenConstrinfunction|SomeDEFAULTcast->str":"|SomeVMcast->str"<:"|SomeNATIVEcast->str"<<:"|None->str":>"typeraw_or_glob_genarg=|RawargofGenarg.raw_generic_argument|GlobargofGenarg.glob_generic_argumentletpr_genargreturnarg=(* In principle this may use the env/sigma, in practice not sure if it
does except through pr_constr_expr in beautify mode. *)letenv=Global.env()inletsigma=Evd.from_envenvinletname,parg=letopenGenarginmatchargwith|Globargarg->letGenArg(Glbwittag,_)=arginbeginmatchtagwith|ExtraArgtag->ArgT.reprtag,Pputils.pr_glb_genericenvsigmaarg|_->assertfalseend|Rawargarg->letGenArg(Rawwittag,_)=arginbeginmatchtagwith|ExtraArgtag->ArgT.reprtag,Pputils.pr_raw_genericenvsigmaarg|_->assertfalseendinletname=(* cheat the name system
there should be a better way to handle this *)ifString.equalname"tactic"then"ltac"elseifString.equalname"ltac2:in-constr"then"ltac2"elseifString.equalname"ltac2:quotation"then""elsenameinletpp=ifString.is_emptynamethenpargelsestrname++str":"++surroundparginreturn(pp,latom)letprprsepinheriteda=letreturn(cmds,prec)=(tag_constr_expracmds,prec)inlet(strm,prec)=matchCAst.(a.v)with|CRef(r,us)->return(pr_crefrus,latom)|CFix(id,fix)->return(hv0(pr_recursive"fix"(pr_fixdecl(prmt)(pr_dangling_with_formtpr))id.vfix),lfix)|CCoFix(id,cofix)->return(hv0(pr_recursive"cofix"(pr_cofixdecl(prmt)(pr_dangling_with_formtpr))id.vcofix),lfix)|CProdN(bl,a)->return(hov0(hov2(pr_delimited_binderspr_forallspctrue(prmtltop)bl)++str","++prspcltopa),lprod)|CLambdaN(bl,a)->return(hov0(hov2(pr_delimited_binderspr_funspctrue(prmtltop)bl)++pr_fun_sep++prspcltopa),llambda)|CLetIn({v=Namex},({v=CFix({v=x'},[_])}|{v=CCoFix({v=x'},[_])}asfx),t,b)whenId.equalxx'->return(hv0(hov2(keyword"let"++spc()++prmtltopfx++spc()++keyword"in")++prspcltopb),lletin)|CLetIn(x,a,t,b)->return(hv0(hov2(keyword"let"++spc()++pr_lnamex++pr_opt_no_spc(funt->str" :"++ws1++prmtltopt)t++str" :="++prspcltopa++spc()++keyword"in")++prspcltopb),lletin)|CProj(true,(f,us),l,c)->letl=List.map(function(c,None)->c|_->assertfalse)linreturn(pr_proj(prmt)pr_appexplc(f,us)l,lproj)|CProj(false,(f,us),l,c)->return(pr_proj(prmt)pr_appc(CAst.make(CRef(f,us)))l,lproj)|CAppExpl((qid,us),[t])|CApp({v=CRef(qid,us)},[t,None])whenqualid_is_identqid&&Id.equal(qualid_basenameqid)Notation_ops.ldots_var->return(hov0(str".."++prspc(LevelLelatom)t++spc()++str".."),larg)|CAppExpl((f,us),l)->return(pr_appexpl(prmt)(f,us)l,lapp)|CApp(a,l)->return(pr_app(prmt)al,lapp)|CRecordl->return(pr_record_body"{|""|}"(prspcltop)l,latom)|CCases(Constr.LetPatternStyle,rtntypopt,[c,as_clause,in_clause],[{v=([[p]],b)}])->return(hv0(keyword"let"++spc()++str"'"++hov0(pr_patt(prmtltop)ltopp++pr_as_in(prmtltop)as_clausein_clause++str" :="++prspcltopc++pr_case_type(pr_dangling_with_formtpr)rtntypopt++spc()++keyword"in"++prspcltopb)),lletpattern)|CCases(_,rtntypopt,c,eqns)->return(v0(hv0(keyword"match"++brk(1,2)++hov0(prlist_with_sepsep_v(pr_case_item(pr_dangling_with_formtpr))c++pr_case_type(pr_dangling_with_formtpr)rtntypopt)++spc()++keyword"with")++prlist(pr_eqn(prmt))eqns++spc()++keyword"end"),latom)|CLetTuple(nal,(na,po),c,b)->return(hv0(hov2(keyword"let"++spc()++hov1(str"("++prlist_with_sepsep_vpr_lnamenal++str")"++pr_simple_return_type(prmt)napo++str" :=")++prspcltopc++keyword" in")++prspcltopb),lletin)|CIf(c,(na,po),b1,b2)->(* On force les parenthèses autour d'un "if" sous-terme (même si le
parsing est lui plus tolérant) *)return(hv0(hov1(keyword"if"++spc()++prmtltopc++pr_simple_return_type(prmt)napo)++spc()++hov0(keyword"then"++pr(fun()->brk(1,1))ltopb1)++spc()++hov0(keyword"else"++pr(fun()->brk(1,1))ltopb2)),lif)|CHole(_,IntroIdentifierid)->return(str"?["++pr_idid++str"]",latom)|CHole(_,IntroFreshid)->return(str"?[?"++pr_idid++str"]",latom)|CHole_->return(str"_",latom)|CGenargarg->pr_genargreturn(Rawargarg)|CGenargGlobarg->pr_genargreturn(Globargarg)|CEvar(n,l)->return(pr_evar(prmt)nl,latom)|CPatVarp->return(str"@?"++pr_patvarp,latom)|CSorts->return(pr_sort_exprs,latom)|CCast(a,k,b)->return(hv0(prmt(LevelLtlcast)a++spc()++(pr_castk)++ws1++prmt(LevelLe(-lcast))b),lcast)|CNotation(_,(_,"( _ )"),([t],[],[],[]))->return(pr(fun()->str"(")ltopt++str")",latom)|CNotation(which,s,env)->pr_notation(prmt)(pr_patt_binder(prmtltop))(pr_binders_gen(prmtltop))whichsenv|CGeneralization(bk,c)->return(pr_generalizationbk(prmtltopc),latom)|CPrimp->return(pr_prim_tokenp,prec_of_prim_tokenp)|CDelimiters(sc,a)->return(pr_delimiterssc(prmt(LevelLeldelim)a),ldelim)|CArray(u,t,def,ty)->hov0(str"[| "++prvect_with_sep(fun()->str"; ")(prmtltop)t++(ifnot(Array.is_emptyt)thenstr" "elsemt())++str"|"++spc()++prmtltopdef++pr_opt_type_spc(prmt)ty++str" |]"++pr_universe_instanceu),0inletloc=constr_locainpr_with_comments?loc(sep()++ifprec_lessprecinheritedthenstrmelsesurroundstrm)typeterm_pr={pr_constr_expr:Environ.env->Evd.evar_map->constr_expr->Pp.t;pr_lconstr_expr:Environ.env->Evd.evar_map->constr_expr->Pp.t;pr_constr_pattern_expr:Environ.env->Evd.evar_map->constr_pattern_expr->Pp.t;pr_lconstr_pattern_expr:Environ.env->Evd.evar_map->constr_pattern_expr->Pp.t}letmodular_constr_pr=prletrecfixrfx=rf(fixrf)xletpr=fixmodular_constr_prmtletprprec=function(* A toplevel printer hack mimicking parsing, incidentally meaning
that we cannot use [pr] correctly anymore in a recursive loop
if the current expr is followed by other exprs which would be
interpreted as arguments *)|{CAst.v=CAppExpl((f,us),[])}->str"@"++pr_creffus|c->prprecclettransfenvsigmac=if!Flags.beautify_filethenletr=Constrintern.intern_gen~strict_check:falseWithoutTypeConstraintenvsigmacinConstrextern.(extern_glob_constr(extern_envenvsigma))relsecletpr_exprenvsigmaprecc=prprec(transfenvsigmac)letpr_simpleconstrenvsigma=pr_exprenvsigmalsimpleconstrletdefault_term_pr={pr_constr_expr=pr_simpleconstr;pr_lconstr_expr=(funenvsigma->pr_exprenvsigmaltop);pr_constr_pattern_expr=pr_simpleconstr;pr_lconstr_pattern_expr=(funenvsigma->pr_exprenvsigmaltop)}letterm_pr=refdefault_term_prletset_term_pr=(:=)term_prletpr_constr_expr_nnc=pr_exprncletpr_constr_exprc=!term_pr.pr_constr_exprcletpr_lconstr_exprc=!term_pr.pr_lconstr_exprcletpr_constr_pattern_exprc=!term_pr.pr_constr_pattern_exprcletpr_lconstr_pattern_exprc=!term_pr.pr_lconstr_pattern_exprcletpr_cases_pattern_expr=pr_patt(prltop)ltopletpr_bindersenvsigma=pr_undelimited_bindersspctrue(pr_exprenvsigmaltop)