123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525(************************************************************************)(* * 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) *)(************************************************************************)(** Abstract representations of values in a vo *)(** NB: This needs updating when the types in declarations.ml and
their dependencies are changed. *)(** We reify here the types of values present in a vo.
in order to validate its structure. Maybe this reification
could become automatically generated someday ?
See values.mli for the meaning of each constructor.
*)typevalue=|Any|Failofstring|Tupleofstring*valuearray|Sumofstring*int*valuearrayarray|Arrayofvalue|Listofvalue|Optofvalue|Int|String|Annotofstring*value|Dyn|Proxyofvalueref|Int64|Float64letfix(f:value->value):value=letself=refAnyinletans=f(Proxyself)inlet()=self:=ansinans(** Some pseudo-constructors *)letv_tuplenamev=Tuple(name,v)letv_sumnameccvv=Sum(name,cc,vv)letv_enumnamen=Sum(name,n,[||])(** Ocaml standard library *)letv_pairv1v2=v_tuple"*"[|v1;v2|]letv_bool=v_enum"bool"2letv_unit=v_enum"unit"1letv_setv=letrecs=Sum("Set.t",1,[|[|s;Annot("elem",v);s;Annot("bal",Int)|]|])insletv_mapvkvd=letrecm=Sum("Map.t",1,[|[|m;Annot("key",vk);Annot("data",vd);m;Annot("bal",Int)|]|])inmletv_hsetv=v_mapInt(v_setv)letv_hmapvkvd=v_mapInt(v_mapvkvd)letv_predv=v_pairv_bool(v_setv)(** kernel/names *)letv_id=Stringletv_dp=Annot("dirpath",Listv_id)letv_name=v_sum"name"1[|[|v_id|]|]letv_uid=v_tuple"uniq_ident"[|Int;String;v_dp|]letrecv_mp=Sum("module_path",0,[|[|v_dp|];[|v_uid|];[|v_mp;v_id|]|])letv_kn=v_tuple"kernel_name"[|v_mp;v_id;Int|]letv_cst=v_sum"cst|mind"0[|[|v_kn|];[|v_kn;v_kn|]|]letv_ind=v_tuple"inductive"[|v_cst;Int|]letv_cons=v_tuple"constructor"[|v_ind;Int|](** kernel/univ *)letv_level_global=v_tuple"Level.Global.t"[|v_dp;String;Int|]letv_raw_level=v_sum"raw_level"1(* Set *)[|(*Level*)[|v_level_global|];(*Var*)[|Int|]|]letv_level=v_tuple"level"[|Int;v_raw_level|]letv_expr=v_tuple"levelexpr"[|v_level;Int|]letv_univ=Listv_exprletv_qvar=v_sum"qvar"0[|[|Int|];[|String;Int|]|]letv_constant_quality=v_enum"constant_quality"3letv_quality=v_sum"quality"0[|[|v_qvar|];[|v_constant_quality|]|]letv_cstrs=Annot("Univ.constraints",v_set(v_tuple"univ_constraint"[|v_level;v_enum"order_request"3;v_level|]))letv_variance=v_enum"variance"3letv_instance=Annot("instance",v_pair(Arrayv_quality)(Arrayv_level))letv_abs_context=v_tuple"abstract_universe_context"[|v_pair(Arrayv_name)(Arrayv_name);v_cstrs|]letv_context_set=v_tuple"universe_context_set"[|v_hsetv_level;v_cstrs|](** kernel/term *)letv_sort=v_sum"sort"3(*SProp, Prop, Set*)[|[|v_univ(*Type*)|];[|v_qvar;v_univ(*QSort*)|]|]letv_relevance=v_sum"relevance"2[|[|v_qvar|]|]letv_binder_annotx=v_tuple"binder_annot"[|x;v_relevance|]letv_puniversesv=v_tuple"punivs"[|v;v_instance|]letv_caseinfo=letv_cstyle=v_enum"case_style"5inletv_cprint=v_tuple"case_printing"[|v_cstyle|]inv_tuple"case_info"[|v_ind;Int;ArrayInt;ArrayInt;v_cprint|]letv_cast=v_enum"cast_kind"3letv_proj_repr=v_tuple"projection_repr"[|v_ind;Int;Int;v_cst|]letv_proj=v_tuple"projection"[|v_proj_repr;v_bool|]letv_uint63=ifSys.word_size==64thenIntelseInt64letrecv_constr=Sum("constr",0,[|[|Int|];(* Rel *)[|v_id|];(* Var *)[|Fail"Meta"|];(* Meta *)[|Fail"Evar"|];(* Evar *)[|v_sort|];(* Sort *)[|v_constr;v_cast;v_constr|];(* Cast *)[|v_binder_annotv_name;v_constr;v_constr|];(* Prod *)[|v_binder_annotv_name;v_constr;v_constr|];(* Lambda *)[|v_binder_annotv_name;v_constr;v_constr;v_constr|];(* LetIn *)[|v_constr;Arrayv_constr|];(* App *)[|v_puniversesv_cst|];(* Const *)[|v_puniversesv_ind|];(* Ind *)[|v_puniversesv_cons|];(* Construct *)[|v_caseinfo;v_instance;Arrayv_constr;v_case_return;v_case_invert;v_constr;Arrayv_case_branch|];(* Case *)[|v_fix|];(* Fix *)[|v_cofix|];(* CoFix *)[|v_proj;v_relevance;v_constr|];(* Proj *)[|v_uint63|];(* Int *)[|Float64|];(* Float *)[|String|];(* String *)[|v_instance;Arrayv_constr;v_constr;v_constr|](* Array *)|])andv_prec=Tuple("prec_declaration",[|Array(v_binder_annotv_name);Arrayv_constr;Arrayv_constr|])andv_fix=Tuple("pfixpoint",[|Tuple("fix2",[|ArrayInt;Int|]);v_prec|])andv_cofix=Tuple("pcofixpoint",[|Int;v_prec|])andv_case_invert=Sum("case_inversion",1,[|[|Arrayv_constr|]|])andv_case_branch=Tuple("case_branch",[|Array(v_binder_annotv_name);v_constr|])andv_case_return=Tuple("case_return",[|Tuple("case_return'",[|Array(v_binder_annotv_name);v_constr|]);v_relevance|])letv_rdecl=v_sum"rel_declaration"0[|[|v_binder_annotv_name;v_constr|];(* LocalAssum *)[|v_binder_annotv_name;v_constr;v_constr|]|](* LocalDef *)letv_rctxt=Listv_rdeclletv_ndecl=v_sum"named_declaration"0[|[|v_binder_annotv_id;v_constr|];(* LocalAssum *)[|v_binder_annotv_id;v_constr;v_constr|]|](* LocalDef *)letv_nctxt=Listv_ndeclletv_section_ctxt=v_enum"emptylist"1(** kernel/mod_subst *)letv_univ_abstractedv=v_tuple"univ_abstracted"[|v;v_abs_context|]letv_delta_hint=v_sum"delta_hint"0[|[|Int;Opt(v_univ_abstractedv_constr)|];[|v_kn|]|]letv_resolver=v_tuple"delta_resolver"[|v_mapv_mpv_mp;v_hmapv_knv_delta_hint|]letv_mp_resolver=v_tuple""[|v_mp;v_resolver|]letv_subst=Annot("substitution",v_mapv_mpv_mp_resolver)(** kernel/lazyconstr *)letv_abstr_info=Tuple("abstr_info",[|v_nctxt;v_abs_context;v_instance|])letv_abstr_inst_info=Tuple("abstr_inst_info",[|Listv_id;v_instance|])letv_expand_info=Tuple("expand_info",[|v_hmapv_cstv_abstr_inst_info;v_hmapv_cstv_abstr_inst_info|])letv_cooking_info=Tuple("cooking_info",[|v_expand_info;v_abstr_info|])letv_opaque=v_sum"opaque"0[|[|Listv_subst;Listv_cooking_info;v_dp;Int|]|](** kernel/declarations *)letv_conv_level=v_sum"conv_level"2[|[|Int|]|]letv_oracle=v_tuple"oracle"[|v_mapv_idv_conv_level;v_hmapv_cstv_conv_level;v_hmapv_proj_reprv_conv_level;v_predv_id;v_predv_cst;v_predv_proj_repr;|]letv_template_arity=v_tuple"template_arity"[|v_sort|]letv_template_universes=v_tuple"template_universes"[|List(Optv_level);v_context_set|]letv_primitive=v_enum"primitive"63(* Number of constructors of the CPrimitives.t type *)letv_cst_def=v_sum"constant_def"0[|[|OptInt|];[|v_constr|];[|v_opaque|];[|v_primitive|];[|v_bool|]|]letv_typing_flags=v_tuple"typing_flags"[|v_bool;v_bool;v_bool;v_oracle;v_bool;v_bool;v_bool;v_bool;v_bool;v_bool;v_bool|]letv_univs=v_sum"universes"1[|[|v_abs_context|]|]letv_vm_reloc_table=Array(v_pairIntInt)letv_vm_annot_switch=v_tuple"vm_annot_switch"[|v_vm_reloc_table;v_bool;Int|]letv_vm_caml_prim=v_enum"vm_caml_prim"6letv_non_subst_reloc=v_sum"vm_non_subst_reloc"0[|[|v_sort|];[|Fail"Evar"|];[|Int|];[|v_instance|];[|Any|];(* contains a Vmvalues.value *)[|v_uint63|];[|Float64|];[|String|];[|v_vm_annot_switch|];[|v_vm_caml_prim|];|]letv_reloc=v_sum"vm_reloc"0[|[|v_ind|];[|v_cst|];[|Int|];|]letv_vm_patches=v_tuple"vm_patches"[|Arrayv_reloc|]letv_vm_pbody_codeindex=v_sum"pbody_code"1[|[|Arrayv_bool;index;v_vm_patches|];[|v_cst|];|]letv_vm_index=v_pairv_dpIntletv_vm_indirect_code=v_vm_pbody_codev_vm_indexletv_vm_emitcodes=Stringletv_vm_fv_elem=v_sum"vm_fv_elem"0[|[|v_id|];[|Int|]|]letv_vm_fv=Arrayv_vm_fv_elemletv_vm_positions=Stringletv_vm_to_patch=v_tuple"vm_to_patch"[|v_vm_emitcodes;v_vm_fv;v_vm_positions;Arrayv_non_subst_reloc|]letv_cb=v_tuple"constant_body"[|v_section_ctxt;v_instance;v_cst_def;v_constr;v_relevance;Optv_vm_indirect_code;v_univs;v_bool;v_typing_flags|]letv_recarg_type=v_sum"recarg_type"0[|[|v_ind|](* Mrec *);[|v_cst|](* NestedPrimitive *)|]letv_recarg=v_sum"recarg"1(* Norec *)[|[|v_recarg_type|](* Mrec *)|]letrecv_wfp=Sum("wf_paths",0,[|[|Int;Int|];(* Rtree.Param *)[|v_recarg;Array(Arrayv_wfp)|];(* Rtree.Node *)[|Int;Arrayv_wfp|](* Rtree.Rec *)|])letv_mono_ind_arity=v_tuple"monomorphic_inductive_arity"[|v_constr;v_sort|]letv_ind_arity=v_sum"inductive_arity"0[|[|v_mono_ind_arity|];[|v_template_arity|]|]letv_squash_info=v_sum"squash_info"1[|[|v_setv_quality|]|]letv_one_ind=v_tuple"one_inductive_body"[|v_id;v_rctxt;v_ind_arity;Arrayv_id;Arrayv_constr;Int;Int;Optv_squash_info;Array(v_pairv_rctxtv_constr);ArrayInt;ArrayInt;v_wfp;v_relevance;Int;Int;v_vm_reloc_table|]letv_finite=v_enum"recursivity_kind"3letv_record_info=v_sum"record_info"2[|[|Array(v_tuple"record"[|v_id;Arrayv_id;Arrayv_relevance;Arrayv_constr|])|]|]letv_ind_pack=v_tuple"mutual_inductive_body"[|Arrayv_one_ind;v_record_info;v_finite;Int;v_section_ctxt;v_instance;Int;Int;v_rctxt;v_univs;(* universes *)Optv_template_universes;Opt(Arrayv_variance);Opt(Arrayv_variance);Optv_bool;v_typing_flags|]letv_prim_ind=v_enum"prim_ind"6(* Number of "Register ... as kernel.ind_..." in PrimInt63.v and PrimFloat.v *)letv_prim_type=v_enum"prim_type"4(* Number of constructors of prim_type in "kernel/cPrimitives.ml" *)letv_retro_action=v_sum"retro_action"0[|[|v_prim_ind;v_ind|];[|v_prim_type;v_cst|];|]letv_retroknowledge=v_sum"module_retroknowledge"1[|[|Listv_retro_action|]|]letv_puniv=OptIntletv_pqvar=OptIntletv_quality_pattern=v_sum"quality_pattern"0[|[|v_pqvar|];[|v_constant_quality|]|]letv_instance_mask=v_pair(Arrayv_quality_pattern)(Arrayv_puniv)letv_sort_pattern=Sum("sort_pattern",3,[|[|v_puniv|];(* PSType *)[|v_pqvar;v_puniv|](* PSQSort *)|])letrecv_hpattern=Sum("head_pattern",0,[|[|Int|];(* PHRel *)[|v_sort_pattern|];(* PHSort *)[|v_cst;v_instance_mask|];(* PHSymbol *)[|v_ind;v_instance_mask|];(* PHInd *)[|v_cons;v_instance_mask|];(* PHConstr *)[|v_uint63|];(* PHInt *)[|Float64|];(* PHFloat *)[|String|];(* PHString *)[|Arrayv_patarg;v_patarg|];(* PHLambda *)[|Arrayv_patarg;v_patarg|];(* PHProd *)|])andv_elimination=Sum("pattern_elimination",0,[|[|Arrayv_patarg|];(* PEApp *)[|v_ind;v_instance_mask;v_patarg;Arrayv_patarg|];(* PECase *)[|v_proj|];(* PEProj *)|])andv_head_elim=Tuple("head*elims",[|v_hpattern;Listv_elimination|])andv_patarg=Sum("pattern_argument",1,[|[|Int|];(* EHole *)[|v_head_elim|];(* ERigid *)|])letv_rewrule=v_tuple"rewrite_rule"[|v_tuple"nvars"[|Int;Int;Int|];v_pairv_instance_mask(Listv_elimination);v_constr|]letv_rrb=v_tuple"rewrite_rules_body"[|List(v_pairv_cstv_rewrule)|]letv_module_with_decl=v_sum"with_declaration"0[|[|Listv_id;v_mp|];[|Listv_id;v_pairv_constr(Optv_abs_context)|];|]letrecv_mae=Sum("module_alg_expr",0,[|[|v_mp|];(* SEBident *)[|v_mae;v_mp|];(* SEBapply *)[|v_mae;v_module_with_decl|](* SEBwith *)|])letrecv_sfb=Sum("struct_field_body",0,[|[|v_cb|];(* SFBconst *)[|v_ind_pack|];(* SFBmind *)[|v_rrb|];(* SFBrules *)[|v_module|];(* SFBmodule *)[|v_modtype|](* SFBmodtype *)|])andv_struc=List(Tuple("label*sfb",[|v_id;v_sfb|]))andv_sign=Sum("module_sign",0,[|[|v_struc|];(* NoFunctor *)[|v_uid;v_modtype;v_sign|]|])(* MoreFunctor *)andv_mexpr=Sum("module_expr",0,[|[|v_mae|];(* MENoFunctor *)[|v_mexpr|]|])(* MEMoreFunctor *)andv_impl=Sum("module_impl",2,(* Abstract, FullStruct *)[|[|v_mexpr|];(* Algebraic *)[|v_struc|]|])(* Struct *)andv_noimpl=v_unitandv_module=Tuple("module_body",[|v_mp;v_impl;v_sign;Optv_mexpr;v_resolver;v_retroknowledge|])andv_modtype=Tuple("module_type_body",[|v_mp;v_noimpl;v_sign;Optv_mexpr;v_resolver;v_unit|])(** kernel/safe_typing *)letv_vodigest=Sum("module_impl",0,[|[|String|];[|String;String|]|])letv_deps=Array(v_tuple"dep"[|v_dp;v_vodigest|])letv_flags=v_tuple"flags"[|v_bool|](* Allow Rewrite Rules *)letv_compiled_lib=v_tuple"compiled"[|v_dp;v_module;v_context_set;v_deps;v_flags|](** STM objects *)letv_frozen=Tuple("frozen",[|List(v_pairIntDyn);OptDyn|])letv_states=v_pairAnyv_frozenletv_state=Tuple("state",[|v_states;Any;v_bool|])letv_vcs=letvcsself=Tuple("vcs",[|Any;Any;Tuple("dag",[|Any;Any;v_mapAny(Tuple("state_info",[|Any;Any;Optv_state;v_pair(Optself)Any|]))|])|])infixvcsletv_uuid=Anyletv_requestiddoc=Tuple("request",[|Any;Any;doc;Any;id;String|])letv_tasks=List(v_pair(v_requestv_uuidv_vcs)v_bool)letv_counters=Anyletv_stm_seg=v_pairv_tasksv_counters(** Toplevel structures in a vo (see Cic.mli) *)letv_libsum=Tuple("summary",[|v_dp;v_deps;String;Any|])letv_lib=Tuple("library",[|v_compiled_lib;Any;Any|])letv_delayed_universes=Sum("delayed_universes",0,[|[|v_unit|];[|v_context_set|]|])letv_opaquetable=Array(Opt(v_pairv_constrv_delayed_universes))letv_univopaques=Opt(Tuple("univopaques",[|v_context_set;v_bool|]))letv_vmlib=v_tuple"vmlibrary"[|v_dp;Arrayv_vm_to_patch|]