package rocq-runtime
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=051f7bf702ff0a3b370449728921e5a95e18bc2b31b8eb949d48422888c98af4
doc/rocq-runtime.kernel/Inductive/index.html
Module InductiveSource
Extracting an inductive type from a construction
find_m*type env sigma c coerce c to an recursive type (I args). find_rectype, find_inductive and find_coinductive respectively accepts any recursive type, only an inductive type and only a coinductive type. They raise Not_found if not convertible to a recursive type.
val find_rectype :
?evars:CClosure.evar_handler ->
Environ.env ->
Constr.types ->
Constr.pinductive * Constr.constr listval find_inductive :
?evars:CClosure.evar_handler ->
Environ.env ->
Constr.types ->
Constr.pinductive * Constr.constr listval find_coinductive :
?evars:CClosure.evar_handler ->
Environ.env ->
Constr.types ->
Constr.pinductive * Constr.constr listFetching information in the environment about an inductive type. Raises an anomaly if the inductive type is not found.
Functions to build standard types related to inductive
val inductive_paramdecls :
Declarations.mutual_inductive_body UVars.puniverses ->
Constr.rel_contextReturns the parameters of an inductive type with universes instantiated
val inductive_nonrec_rec_paramdecls :
Declarations.mutual_inductive_body UVars.puniverses ->
Constr.rel_context * Constr.rel_contextReturns the parameters of an inductive type with universes instantiated, splitting it into the contexts of recursively uniform and recursively non-uniform parameters
val instantiate_inductive_constraints :
Declarations.mutual_inductive_body ->
UVars.Instance.t ->
Univ.Constraints.tval instantiate_template_constraints :
template_univ Univ.Level.Map.t ->
Declarations.template_universes ->
Univ.Constraints.tval instantiate_template_universes :
Declarations.mind_specif ->
param_univs ->
Univ.Constraints.t * Constr.rel_context * template_univ Univ.Level.Map.tval constrained_type_of_inductive :
Declarations.mind_specif UVars.puniverses ->
Constr.types Univ.constrainedval relevance_of_ind_body :
Declarations.one_inductive_body ->
UVars.Instance.t ->
Sorts.relevanceval type_of_inductive_knowing_parameters :
Declarations.mind_specif UVars.puniverses ->
param_univs ->
Constr.types Univ.constrainedFor squashing.
Return type as quoted by the user
val constrained_type_of_constructor :
Constr.pconstructor ->
Declarations.mind_specif ->
Constr.types Univ.constrainedval type_of_constructor_knowing_parameters :
Constr.pconstructor ->
Declarations.mind_specif ->
param_univs ->
Constr.types Univ.constrainedval arities_of_constructors :
Constr.pinductive ->
Declarations.mind_specif ->
Constr.types arrayReturn constructor types in normal form
val type_of_constructors :
Constr.pinductive ->
Declarations.mind_specif ->
Constr.types arrayReturn constructor types in user form
val abstract_constructor_type_relatively_to_inductive_types_context :
int ->
Names.MutInd.t ->
Constr.types ->
Constr.typesTurns a constructor type recursively referring to inductive types into the same constructor type referring instead to a context made from the abstract declaration of the inductive types (e.g. turns nat->nat into mkArrowR (Rel 1) (Rel 2)); takes as arguments the number of inductive types in the block and the name of the block
val expand_arity :
Declarations.mind_specif ->
Constr.pinductive ->
Constr.constr array ->
Names.Name.t Constr.binder_annot array ->
Constr.rel_contextGiven an inductive type and its parameters, builds the context of the return clause, including the inductive being eliminated. The additional binder array is only used to set the names of the context variables, we use the less general type to make it easy to use this function on Case nodes.
val expand_branch_contexts :
Declarations.mind_specif ->
UVars.Instance.t ->
Constr.constr array ->
(Names.Name.t Constr.binder_annot array * 'a) array ->
Constr.rel_context arrayGiven an inductive type and its parameters, builds the context of the return clause, including the inductive being eliminated. The additional binder array is only used to set the names of the context variables, we use the less general type to make it easy to use this function on Case nodes.
type ('constr, 'types, 'r) pexpanded_case =
Constr.case_info
* ('constr * 'r)
* 'constr Constr.pcase_invert
* 'constr
* 'constr arrayGiven a pattern-matching represented compactly, expands it so as to produce lambda and let abstractions in front of the return clause and the pattern branches.
Dual operation of the above. Fails if the return clause or branch has not the expected form.
val instantiate_context :
UVars.Instance.t ->
Vars.substl ->
Names.Name.t Constr.binder_annot array ->
Constr.rel_context ->
Constr.rel_contextinstantiate_context u subst nas ctx applies both u and subst to ctx while replacing names using nas (order reversed). In particular, assumes that ctx and nas have the same length.
val build_branches_type :
Constr.pinductive ->
(Declarations.mutual_inductive_body * Declarations.one_inductive_body) ->
Constr.constr list ->
Constr.constr ->
Constr.types arrayCheck a case_info actually correspond to a Case expression on the given inductive type.
Guard conditions for fix and cofix-points.
is_primitive_positive_container env c tells if the constant c is registered as a primitive type that can be seen as a container where the occurrences of its parameters are positive, in which case the positivity and guard conditions are extended to allow inductive types to nest their subterms in these containers.
When chk is false, the guard condition is not actually checked.
val abstract_mind_lc :
int ->
int ->
Names.MutInd.t ->
(Constr.rel_context * Constr.constr) array ->
Constr.constr array