Safe_typingSourceSince we are now able to type terms, we can define an abstract type of safe environments, where objects are typed before being added.
We also provide functionality for modules : start_module, end_module, etc.
The safe_environment state monad
concat_private e1 e2 adds the constants of e1 to e2, i.e. constants in e1 must be more recent than those of e2.
val inline_private_constants :
Environ.env ->
private_constants Entries.proof_output ->
Constr.constr Univ.in_universe_context_setPush the constants in the environment if not already there.
Enriching a safe environment
Insertion of global axioms or definitions
type global_declaration = | ConstantEntry : Entries.constant_entry -> global_declaration| OpaqueEntry : private_constants Entries.const_entry_body Entries.opaque_entry ->
global_declarationtype side_effect_declaration = | DefinitionEff : Entries.definition_entry -> side_effect_declaration| OpaqueEff : Constr.constr Entries.opaque_entry -> side_effect_declarationval export_private_constants :
private_constants ->
exported_private_constant list safe_transformerval add_constant :
?typing_flags:Declarations.typing_flags ->
Names.Label.t ->
global_declaration ->
Names.Constant.t safe_transformerreturns the main constant
val add_private_constant :
Names.Label.t ->
side_effect_declaration ->
(Names.Constant.t * private_constants) safe_transformerSimilar to add_constant but also returns a certificate
Adding an inductive type
val add_mind :
?typing_flags:Declarations.typing_flags ->
Names.Label.t ->
Entries.mutual_inductive_entry ->
Names.MutInd.t safe_transformerAdding a module or a module type
val add_module :
Names.Label.t ->
Entries.module_entry ->
Declarations.inline ->
(Names.ModPath.t * Mod_subst.delta_resolver) safe_transformerval add_modtype :
Names.Label.t ->
Entries.module_type_entry ->
Declarations.inline ->
Names.ModPath.t safe_transformerAdding universe constraints
Setting the type theory flavor
Insertion of local declarations (Local or Variables)
Add local universes to a polymorphic section
val add_module_parameter :
Names.MBId.t ->
Entries.module_struct_entry ->
Declarations.inline ->
Mod_subst.delta_resolver safe_transformerTraditional mode: check at end of module that no future was created.
The optional result type is given without its functorial part
val end_module :
Names.Label.t ->
(Entries.module_struct_entry * Declarations.inline) option ->
(Names.ModPath.t * Names.MBId.t list * Mod_subst.delta_resolver)
safe_transformerval add_include :
Entries.module_struct_entry ->
bool ->
Declarations.inline ->
Mod_subst.delta_resolver safe_transformerval export :
?except:Future.UUIDSet.t ->
output_native_objects:bool ->
safe_environment ->
Names.DirPath.t ->
Names.ModPath.t * compiled_library * Nativelib.native_libraryval import :
compiled_library ->
Univ.ContextSet.t ->
vodigest ->
Names.ModPath.t safe_transformerThe safe typing of a term returns a typing judgment.