package coq-core
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=9a35311acec2a806730b94ac7dceabc88837f235c52a14c026827d9b89433bd7fa9555a9fc6829aa49edfedb24c8bbaf1411ebf463b74a50aeb17cba47745b6b
doc/coq-core.kernel/Safe_typing/index.html
Module Safe_typing
Source
Safe environments
Since 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
Stm machinery
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_set
Push 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 : unit Entries.opaque_entry -> global_declaration
type side_effect_declaration =
| DefinitionEff : Entries.definition_entry -> side_effect_declaration
| OpaqueEff : Constr.constr Entries.opaque_entry -> side_effect_declaration
val repr_exported_opaque :
exported_opaque ->
Opaqueproof.opaque_handle * Opaqueproof.opaque_proofterm
val export_private_constants :
private_constants ->
exported_private_constant list safe_transformer
val add_constant :
?typing_flags:Declarations.typing_flags ->
Names.Label.t ->
global_declaration ->
Names.Constant.t safe_transformer
returns the main constant
val add_private_constant :
Names.Label.t ->
Univ.ContextSet.t ->
side_effect_declaration ->
(Names.Constant.t * private_constants) safe_transformer
Similar to add_constant but also returns a certificate
Delayed proofs
Witness that a delayed Qed hole has a proof. This datatype is marshallable but care must be taken to marshal it at the same time as the environment it is referring to, since fill_opaque
relies on a shared pointer between the environment and the certificate.
val check_opaque :
safe_environment ->
Opaqueproof.opaque_handle ->
private_constants Entries.proof_output ->
opaque_certificate
Check that the provided proof is correct for the corresponding handle. This does not modify the environment. Call fill_opaque
below for that.
Given an already checked proof for an opaque hole, actually fill it with the proof. This might fail if the current set of global universes is inconsistent with the one at the time of the call to check_opaque
. Precondition: the underlying handle must exist and must not have been filled.
Check whether a handle was filled. It assumes that the handle was introduced in the opaque table and throws an anomaly otherwise.
val repr_certificate :
opaque_certificate ->
Constr.t * Univ.ContextSet.t Opaqueproof.delayed_universes
Get the proof term that was checked by the kernel.
Inductive blocks
Adding an inductive type
val add_mind :
?typing_flags:Declarations.typing_flags ->
Names.Label.t ->
Entries.mutual_inductive_entry ->
Names.MutInd.t safe_transformer
Adding 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_transformer
val add_modtype :
Names.Label.t ->
Entries.module_type_entry ->
Declarations.inline ->
Names.ModPath.t safe_transformer
Adding universe constraints
Setting the type theory flavor
Interactive section functions
Insertion of local declarations (Local or Variables)
Add local universes to a polymorphic section
Interactive module functions
val add_module_parameter :
Names.MBId.t ->
Entries.module_struct_entry ->
Declarations.inline ->
Mod_subst.delta_resolver safe_transformer
returns the number of module (type) parameters following the nested module structure. The inner module (type) comes first in the list.
returns true if the module is a module type following the nested module structure. The inner module (type) comes first in the list. true means a module type, false a regular module
Traditional 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_transformer
val add_include :
Entries.module_struct_entry ->
bool ->
Declarations.inline ->
Mod_subst.delta_resolver safe_transformer
Libraries : loading and saving compilation units
val export :
output_native_objects:bool ->
safe_environment ->
Names.DirPath.t ->
Names.ModPath.t * compiled_library * Nativelib.native_library
val import :
compiled_library ->
Univ.ContextSet.t ->
vodigest ->
Names.ModPath.t safe_transformer
Safe typing judgments
The safe typing of a term returns a typing judgment.