Debian Codegraph @

kernel/entries.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Names
12 open Constr
13
14 (** This module defines the entry types for global declarations. This
15 information is entered in the environments. This includes global
16 constants/axioms, mutual inductive definitions, modules and module
17 types *)
18
19 type universes_entry =
20 | Monomorphic_entry
21 | Polymorphic_entry of UVars.UContext.t
22
23 type inductive_universes_entry =
24 | Monomorphic_ind_entry
25 | Polymorphic_ind_entry of UVars.UContext.t
26 | Template_ind_entry of {
27 uctx : UVars.UContext.t;
28 (* The quality part of default_univs must be all qtype *)
29 default_univs : UVars.Instance.t;
30 }
31
32 type variance_entry = UVars.Variance.t option array
33
34 type 'a in_universes_entry = 'a * universes_entry
35
36 (** {6 Declaration of inductive types. } *)
37
38 (** Assume the following definition in concrete syntax:
39 {v Inductive I1 (x1:X1) ... (xn:Xn) : A1 := c11 : T11 | ... | c1n1 : T1n1
40 ...
41 with Ip (x1:X1) ... (xn:Xn) : Ap := cp1 : Tp1 | ... | cpnp : Tpnp. v}
42
43 then, in i{^ th} block, [mind_entry_params] is [xn:Xn;...;x1:X1];
44 [mind_entry_arity] is [Ai], defined in context [x1:X1;...;xn:Xn];
45 [mind_entry_lc] is [Ti1;...;Tini], defined in context [[A'1;...;A'p;x1:X1;...;xn:Xn]] where [A'i] is [Ai] generalized over [[x1:X1;...;xn:Xn]].
46 *)
47
48 type one_inductive_entry = {
49 mind_entry_typename : Id.t;
50 mind_entry_arity : constr;
51 mind_entry_consnames : Id.t list;
52 mind_entry_lc : constr list;
53 }
54
55 type mutual_inductive_entry = {
56 mind_entry_record : (Id.t array option) option;
57 (** Some (Some ids): primitive records with ids the binder name of each
58 record in their respective projections. Not used by the kernel.
59 Some None: non-primitive record *)
60 mind_entry_finite : Declarations.recursivity_kind;
61 mind_entry_params : Constr.rel_context;
62 mind_entry_inds : one_inductive_entry list;
63 mind_entry_universes : inductive_universes_entry;
64 mind_entry_variance : variance_entry option;
65 (* [None] if non-cumulative, otherwise associates each universe of
66 the entry to [None] if to be inferred or [Some v] if to be
67 checked. *)
68 mind_entry_private : bool option;
69 }
70
71 (** {6 Constants (Definition/Axiom) } *)
72
73 type definition_entry = {
74 definition_entry_body : constr;
75 (* List of section variables *)
76 definition_entry_secctx : Id.Set.t option;
77 definition_entry_type : types option;
78 definition_entry_universes : universes_entry;
79 definition_entry_inline_code : bool;
80 }
81
82 type section_def_entry = {
83 secdef_body : constr;
84 secdef_type : types option;
85 }
86
87 type 'a opaque_entry = {
88 opaque_entry_body : 'a;
89 (* List of section variables *)
90 opaque_entry_secctx : Id.Set.t;
91 opaque_entry_type : types;
92 opaque_entry_universes : universes_entry;
93 }
94
95 type inline = int option (* inlining level, None for no inlining *)
96
97 type parameter_entry = {
98 parameter_entry_secctx : Id.Set.t option;
99 parameter_entry_type : types;
100 parameter_entry_universes : universes_entry;
101 parameter_entry_inline_code : inline;
102 }
103
104 type primitive_entry = {
105 prim_entry_type : types in_universes_entry option;
106 prim_entry_content : CPrimitives.op_or_type;
107 }
108
109 type symbol_entry = {
110 symb_entry_type : types;
111 symb_entry_unfold_fix: bool;
112 symb_entry_universes : universes_entry;
113 }
114
115 type 'a proof_output = (constr * Univ.ContextSet.t) * 'a
116
117 type constant_entry =
118 | DefinitionEntry : definition_entry -> constant_entry
119 | OpaqueEntry : unit opaque_entry -> constant_entry
120 | ParameterEntry : parameter_entry -> constant_entry
121 | PrimitiveEntry : primitive_entry -> constant_entry
122 | SymbolEntry : symbol_entry -> constant_entry
123
124 (** {6 Modules } *)
125
126 type module_struct_entry = (constr * UVars.AbstractContext.t option) Declarations.module_alg_expr
127
128 type module_params_entry =
129 (MBId.t * module_struct_entry * inline) list (** older first *)
130
131 type module_type_entry = module_params_entry * module_struct_entry
132
133 type module_entry =
134 | MType of module_params_entry * module_struct_entry
135 | MExpr of
136 module_params_entry * module_struct_entry * module_struct_entry option