1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253moduleB=Kernel.BasicmoduleF=Common.FilesmoduleT=Kernel.TermmoduleU=Common.UniversesexceptionNot_uvar(** prefix for all the universe variables. *)letbasename="?"(** Check if a term should be elaborated by a fresh variable *)letis_pre_vart=matchtwithT.Const(_,n)whenn=U.pvar()->true|_->false(** Check if a term is universe variable, i.e. its ident should be ?11, ?43... *)letis_uvart=matchtwith|T.Const(_,n)->lets=B.string_of_ident(B.idn)inletn=String.lengthbasenameinString.lengths>n&&String.subs0n=basename|_->false(** [name_of_uvar t] returns the name of universe variable if [t] is a universe variable, raise [Not_uvar] otherwise *)letname_of_uvart=matchtwithT.Const(_,n)whenis_uvart->n|_->raiseNot_uvar(** Internal counter use by this module to generate fresh variables *)letcounter=ref0(** Generate a fresh name for a universe variable *)letfresh()=letname=Format.sprintf"%s%d"basename!counterinincrcounter;B.mk_identname(** [fresh_uvar env ()] returns a fresh term representing a universe variable. Add a new declaration into the module env.md *)letfresh_uvar:F.coutF.t->unit->T.term=funfile()->letid=fresh()inletuvar=B.mk_namefile.mdidinletuterm=T.mk_ConstB.dlocuvarinletsort_type=letmd_theory=!U.md_theoryinT.mk_ConstB.dloc(B.mk_namemd_theory(B.mk_ident"Sort"))inFormat.fprintf(F.fmt_of_filefile)"%a@."Api.Pp.Default.print_entry(Parsers.Entry.Decl(B.dloc,id,Kernel.Signature.Public,Kernel.Signature.DefinableT.Free,sort_type));uterm