Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file elaborate.ml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465moduleE=Parsers.EntrymoduleF=Common.FilesmoduleL=Common.LogmoduleM=Api.MetamoduleP=Api.Pp.DefaultmoduleR=Kernel.RulemoduleT=Kernel.Termtypet={file:F.coutF.t;(** File where universe declarations are printed *)meta:M.cfg;(** Meta rules that translates universes to the pre-universe variable *)}(** Takes a term [t] where universes are elaborated as pre-universe variables and returns a term where all the pre-universe variables are fresh universe variables *)letrecmk_term:t->T.term->T.term=funenvt->ifVar.is_pre_vartthenVar.fresh_uvarenv.file()elsematchtwith|T.Kind|T.Type_|T.DB(_,_,_)|T.Const(_,_)->t|T.App(f,a,args)->T.mk_App2(mk_termenvf)(List.map(mk_termenv)(a::args))|T.Lam(lc,id,Somety,te)->T.mk_Lamlcid(Some(mk_termenvty))(mk_termenvte)|T.Lam(lc,id,None,te)->T.mk_LamlcidNone(mk_termenvte)|T.Pi(lc,id,tya,tyb)->T.mk_Pilcid(mk_termenvtya)(mk_termenvtyb)(** [mk_term env t] replaces all the concrete universes in [t] by a fresh variable
using the environment env. *)letmk_term:t->T.term->T.term=funenvt->(* Generate pre-universe variable first by replacing each universe with a pre-universe variable *)(* env.meta maps all the concrete universe to a unique constructor universo.var *)lett=M.mk_termenv.metatinmk_termenvt(** [mkrule env r] replaces all the concrete universes in [rule.rhs] by a fresh variable
using the environement env. *)letmk_rule:t->'aR.rule->'aR.rule=funenvrule->R.{rulewithrhs=mk_termenv(M.mk_termenv.metarule.rhs)}(** [mk_entry env entry] replaces all the concrete universes in [entry] by a fresh variable
using the environment env. Commands are skipped. *)letmk_entry:t->E.entry->E.entry=funenve->letfmt=F.fmt_of_fileenv.fileinmatchewith|Decl(lc,id,scope,st,ty)->L.log_elab"[ELAB] %a"P.print_identid;Format.fprintffmt"(; %a ;)@."P.print_identid;Decl(lc,id,scope,st,mk_termenvty)|Def(lc,id,scope,op,mty,te)->L.log_elab"[ELAB] %a"P.print_identid;Format.fprintffmt"(; %a ;)@."P.print_identid;letmty'=matchmtywithNone->None|Somety->Some(mk_termenvty)inlette'=mk_termenvteinDef(lc,id,scope,op,mty',te')|Rules(lc,rs)->Format.fprintffmt"(; RULES ;)@.";Rules(lc,List.map(mk_ruleenv)rs)|_->e