| 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 Coercionops |
| 13 | |
| 14 | (** Classes and coercions. *) |
| 15 | |
| 16 | (** [try_add_new_coercion_with_target ref s src tg] declares [ref] as a coercion |
| 17 | from [src] to [tg] *) |
| 18 | val try_add_new_coercion_with_target |
| 19 | : GlobRef.t |
| 20 | -> local:bool |
| 21 | -> reversible:bool |
| 22 | -> source:cl_typ |
| 23 | -> target:cl_typ |
| 24 | -> unit |
| 25 | |
| 26 | (** [try_add_new_coercion ref s] declares [ref], assumed to be of type |
| 27 | [(x1:T1)...(xn:Tn)src->tg], as a coercion from [src] to [tg] *) |
| 28 | val try_add_new_coercion : GlobRef.t -> local:bool -> |
| 29 | reversible:bool -> unit |
| 30 | |
| 31 | (** [try_add_new_coercion_subclass cst s] expects that [cst] denotes a |
| 32 | transparent constant which unfolds to some class [tg]; it declares |
| 33 | an identity coercion from [cst] to [tg], named something like |
| 34 | ["Id_cst_tg"] *) |
| 35 | val try_add_new_coercion_subclass : ?loc:Loc.t -> cl_typ -> local:bool -> poly:PolyFlags.t -> |
| 36 | reversible:bool -> unit |
| 37 | |
| 38 | (** [try_add_new_coercion_with_source ref s src] declares [ref] as a coercion |
| 39 | from [src] to [tg] where the target is inferred from the type of [ref] *) |
| 40 | val try_add_new_coercion_with_source : GlobRef.t -> local:bool -> |
| 41 | reversible:bool -> source:cl_typ -> unit |
| 42 | |
| 43 | (** [try_add_new_identity_coercion id s src tg] enriches the |
| 44 | environment with a new definition of name [id] declared as an |
| 45 | identity coercion from [src] to [tg] *) |
| 46 | val try_add_new_identity_coercion |
| 47 | : lident |
| 48 | -> local:bool |
| 49 | -> poly:PolyFlags.t -> source:cl_typ -> target:cl_typ -> unit |
| 50 | |
| 51 | val coercion_hook : reversible:bool -> Declare.Hook.t |
| 52 | |
| 53 | val subclass_hook : poly:PolyFlags.t -> reversible:bool -> Declare.Hook.t |
| 54 | |
| 55 | val class_of_global : GlobRef.t -> cl_typ |
| 56 | |
| 57 | (** Attribute to silence warning for coercions that don't satisfy |
| 58 | the uniform inheritance condition. (deprecated in 8.18) *) |
| 59 | val nonuniform : bool option Attributes.attribute |
| 60 | |
| 61 | val change_reverse : GlobRef.t -> reversible:bool -> unit |