package rocq-runtime
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b236dc44f92e1eeca6877c7ee188a90c2303497fe7beb99df711ed5a7ce0d824
doc/rocq-runtime.pretyping/Typeclasses/index.html
Module TypeclassesSource
type typeclass = {cl_univs : UVars.AbstractContext.t;(*The toplevel universe quantification in which the typeclass lives. In particular,
*)cl_propsandcl_contextare quantified over it.cl_impl : Names.GlobRef.t;(*The class implementation: a record parameterized by the context with defs in it or a definition if the class is a singleton. This acts as the class' global identifier.
*)cl_context : Constr.rel_context;(*Context in which the definitions are typed.
*)cl_trivial : bool;(*Class declared with "Class Foo params := {
}
", produces 0 goals in interactive mode.
*)cl_props : Constr.rel_context;(*Context of definitions and properties on defs, used for "Instance := {
}
". If
*)cl_implis a record this is the arguments of its constructor (without parameters). Otherwise it is a singleLocalAssumof type convertible tocl_impl.cl_projs : class_method list;(*The methods implementations of the typeclass as projections. Some may be undefinable due to sorting restrictions or simply undefined if no name is provided. Used for dumpglob in "Instance := {
}
" and in elpi.
*)cl_strict : bool;(*Whether we use matching or full unification during resolution
*)cl_unique : bool;(*Whether we can assume that instances are unique, which allows no backtracking and sharing of resolution.
*)
}This module defines type-classes
None if not a class
raise TypeClassError if not a class
None if not a class
raise TypeClassError if not a class
val dest_class_app :
Environ.env ->
Evd.evar_map ->
EConstr.constr ->
(typeclass * EConstr.EInstance.t) * Constr.constr listThese raise a UserError if not a class. Caution: the typeclass structures is not instantiated w.r.t. the universe instance. This is done separately by typeclass_univ_instance.
val class_of_constr :
Environ.env ->
Evd.evar_map ->
EConstr.constr ->
(EConstr.rel_context
* ((typeclass * EConstr.EInstance.t) * Constr.constr list))
optionJust return None if not a class
Filter which evars to consider for resolution.
Resolvability. Only undefined evars can be marked or checked for resolvability. They represent type-class search roots.
A resolvable evar is an evar the type-class engine may try to solve An unresolvable evar is an evar the type-class engine will NOT try to solve
val resolve_typeclasses :
?filter:evar_filter ->
?unique:bool ->
?fail:bool ->
Environ.env ->
Evd.evar_map ->
Evd.evar_mapval set_solve_all_instances :
(Environ.env -> Evd.evar_map -> evar_filter -> bool -> bool -> Evd.evar_map) ->
unitA plugin can override the TC resolution engine by calling these two APIs. Beware this action is not registed in the summary (the Undo system) so it is up to the plugin to do so.
val resolve_one_typeclass :
?unique:bool ->
Environ.env ->
Evd.evar_map ->
EConstr.types ->
Evd.evar_map * EConstr.constrval set_solve_one_instance :
(Environ.env ->
Evd.evar_map ->
EConstr.types ->
Evd.evar_map * EConstr.constr) ->
unit