Debian Codegraph @

library/global.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 Declarations
13 open Mod_declarations
14
15 (** This module defines the global environment of Rocq. The functions
16 below are exactly the same as the ones in [Safe_typing], operating on
17 that global environment. [add_*] functions perform name verification,
18 i.e. check that the name given as argument match those provided by
19 [Safe_typing]. *)
20
21 val safe_env : unit -> Safe_typing.safe_environment
22 val env : unit -> Environ.env
23
24 val universes : unit -> UGraph.t
25 val qualities : unit -> Sorts.QVar.Set.t
26 val elim_graph : unit -> QGraph.t
27 val named_context_val : unit -> Environ.named_context_val
28 val named_context : unit -> Constr.named_context
29
30 (** {6 Enriching the global environment } *)
31
32 (** Changing the (im)predicativity of the system *)
33 val set_impredicative_set : bool -> unit
34
35 val set_indices_matter : bool -> unit
36 val set_typing_flags : typing_flags -> unit
37 val set_check_guarded : bool -> unit
38 val set_check_positive : bool -> unit
39 val set_check_universes : bool -> unit
40 val typing_flags : unit -> typing_flags
41 val set_allow_sprop : bool -> unit
42 val sprop_allowed : unit -> bool
43 val set_rewrite_rules_allowed : bool -> unit
44 val rewrite_rules_allowed : unit -> bool
45
46 (** Variables, Local definitions, constants, inductive types *)
47
48 val push_named_assum : (Id.t * Constr.types) -> unit
49 val push_named_def : (Id.t * Entries.section_def_entry) -> unit
50 val push_section_context : UVars.UContext.t -> unit
51
52 val export_private_constants :
53 Safe_typing.private_constants ->
54 Safe_typing.exported_private_constant list
55
56 val add_constant :
57 ?typing_flags:typing_flags ->
58 Id.t -> Entries.constant_entry -> Constant.t
59 val fill_opaque : Safe_typing.opaque_certificate -> unit
60 val add_rewrite_rules : Id.t -> rewrite_rules_body -> unit
61 val add_mind :
62 ?typing_flags:typing_flags ->
63 Id.t -> Entries.mutual_inductive_entry ->
64 MutInd.t * IndTyping.NotPrimRecordReason.t option
65
66 (** Extra universe constraints *)
67 val add_univ_constraints : Univ.UnivConstraints.t -> unit
68
69 val push_context_set : Univ.ContextSet.t -> unit
70
71 (** Extra sort qualities *)
72 val push_qualities : rigid:bool -> Sorts.QContextSet.t -> unit
73
74 (** Non-interactive modules and module types *)
75
76 val add_module :
77 Id.t -> Entries.module_entry -> inline ->
78 ModPath.t * Mod_subst.delta_resolver
79 val add_modtype :
80 Id.t -> Entries.module_type_entry -> inline -> ModPath.t
81 val add_include :
82 Entries.module_struct_entry -> bool -> inline ->
83 Mod_subst.delta_resolver
84
85 (** Sections *)
86
87 val open_section : unit -> unit
88 (** [poly] is true when the section should be universe polymorphic *)
89
90 val close_section : Summary.Interp.frozen -> unit
91 (** Close the section and reset the global state to the one at the time when
92 the section what opened. *)
93
94 val sections_are_opened : unit -> bool
95
96 (** {6 Section management for discharge } *)
97
98 val section_segment_of_constant : Constant.t -> Cooking.cooking_info
99 val section_segment_of_inductive: MutInd.t -> Cooking.cooking_info
100 val section_segment_of_reference : GlobRef.t -> Cooking.cooking_info
101
102 val section_instance : GlobRef.t -> Constr.t array
103 val is_in_section : GlobRef.t -> bool
104
105 (** [discharge_proj_repr p] discharges projection [p] if the associated record
106 was defined in the current section. If that is not the case, it returns [p]
107 unchanged. *)
108 val discharge_proj_repr : Projection.Repr.t -> Projection.Repr.t
109
110 (** Interactive modules and module types *)
111
112 val start_module : Id.t -> ModPath.t
113 val start_modtype : Id.t -> ModPath.t
114
115 val end_module : Summary.Interp.frozen -> Id.t ->
116 (Entries.module_struct_entry * inline) option ->
117 ModPath.t * MBId.t list * Mod_subst.delta_resolver
118
119 val end_modtype : Summary.Interp.frozen -> Id.t -> ModPath.t * MBId.t list
120
121 val add_module_parameter :
122 MBId.t -> Entries.module_struct_entry -> inline ->
123 module_type_body
124
125 (** {6 Queries in the global environment } *)
126
127 val lookup_named : variable -> Constr.named_declaration
128 val lookup_constant : Constant.t -> constant_body
129 val lookup_inductive : inductive ->
130 mutual_inductive_body * one_inductive_body
131 val lookup_pinductive : Constr.pinductive ->
132 mutual_inductive_body * one_inductive_body
133 val lookup_mind : MutInd.t -> mutual_inductive_body
134 val lookup_module : ModPath.t -> module_body
135 val lookup_modtype : ModPath.t -> module_type_body
136 val exists_objlabel : Id.t -> bool
137
138 val constant_of_delta_kn : KerName.t -> Constant.t
139 val mind_of_delta_kn : KerName.t -> MutInd.t
140
141 type indirect_accessor = {
142 access_proof : Opaqueproof.opaque -> Opaqueproof.opaque_proofterm option;
143 }
144
145 val force_proof : indirect_accessor -> Opaqueproof.opaque -> Opaqueproof.opaque_proofterm
146
147 val body_of_constant : indirect_accessor -> Constant.t ->
148 (Constr.constr * unit Opaqueproof.delayed_universes * UVars.AbstractContext.t) option
149 (** Returns the body of the constant if it has any, and the polymorphic context
150 it lives in. For monomorphic constant, the latter is empty, and for
151 polymorphic constants, the term contains De Bruijn universe variables that
152 need to be instantiated. *)
153
154 val body_of_constant_body : indirect_accessor ->
155 constant_body ->
156 (Constr.constr * unit Opaqueproof.delayed_universes * UVars.AbstractContext.t) option
157 (** Same as {!body_of_constant} but on {!constant_body}. *)
158
159 (** {6 Compiled libraries } *)
160
161 val start_library : DirPath.t -> ModPath.t
162 val export : output_native_objects:bool -> DirPath.t ->
163 ModPath.t * Safe_typing.compiled_library * Vmlibrary.compiled_library * Nativelib.native_library
164 val import :
165 Safe_typing.compiled_library -> Vmlibrary.on_disk -> Safe_typing.vodigest ->
166 ModPath.t
167
168 (** {6 Misc } *)
169
170 (** Function to get an environment from the constants part of the global
171 * environment and a given context. *)
172
173 val env_of_context : Environ.named_context_val -> Environ.env
174
175 val is_joined_environment : unit -> bool
176 val is_curmod_library : unit -> bool
177
178 val is_polymorphic : GlobRef.t -> bool
179 val is_template_polymorphic : GlobRef.t -> bool
180 val is_type_in_type : GlobRef.t -> bool
181
182 (** {6 Retroknowledge } *)
183
184 val register_inline : Constant.t -> unit
185 val register_inductive : inductive -> 'a CPrimitives.prim_ind -> unit
186
187 (** {6 Oracle } *)
188
189 val set_strategy : Conv_oracle.evaluable -> Conv_oracle.level -> unit
190
191 (** {6 Conversion settings } *)
192
193 val set_share_reduction : bool -> unit
194
195 val set_VM : bool -> unit
196 val set_native_compiler : bool -> unit
197
198 (* Modifies the global state, registering new universes *)
199
200 val current_modpath : unit -> ModPath.t
201
202 val current_dirpath : unit -> DirPath.t
203
204 val global_env_summary_tag : Safe_typing.safe_environment Summary.Dyn.tag
205
206 module Internal :
207 sig
208
209 val reset_safe_env : Safe_typing.safe_environment -> unit
210 (** Only use for manipulation of private constants *)
211
212 end