Debian Codegraph @

pretyping/coercionops.mli

raw symbols SCIP
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 Environ
13 open EConstr
14 open Evd
15 open Mod_subst
16
17 (** {6 This is the type of class kinds } *)
18 type cl_typ =
19 | CL_SORT
20 | CL_FUN
21 | CL_SECVAR of variable
22 | CL_CONST of Constant.t
23 | CL_IND of inductive
24 | CL_PROJ of Projection.Repr.t
25
26 (** Equality over [cl_typ] *)
27 val cl_typ_eq : cl_typ -> cl_typ -> bool
28
29 val subst_cl_typ : env -> substitution -> cl_typ -> cl_typ
30
31 (** Comparison of [cl_typ] *)
32 val cl_typ_ord : cl_typ -> cl_typ -> int
33
34 (** This is the type of coercion kinds *)
35 type coe_typ = GlobRef.t
36
37 (** This is the type of infos for declared coercions *)
38 type coe_info_typ = {
39 coe_value : GlobRef.t;
40 coe_local : bool;
41 coe_reversible : bool;
42 coe_is_identity : bool;
43 coe_is_projection : Projection.Repr.t option;
44 coe_source : cl_typ;
45 coe_target : cl_typ;
46 coe_param : int;
47 }
48
49 (** This is the type of paths from a class to another *)
50 type inheritance_path = coe_info_typ list
51
52 (** {6 Access to classes infos } *)
53
54 val class_exists : cl_typ -> bool
55
56 (** @raise Not_found if this type is not a class *)
57 val class_nparams : cl_typ -> int
58
59 (** [find_class_type env sigma c] returns the head reference of [c],
60 its universe instance and its arguments *)
61 val find_class_type : env -> evar_map -> types -> cl_typ * EInstance.t * constr list
62
63 val find_class_glob_type : 'a Glob_term.glob_constr_g -> cl_typ
64
65 (** raises [Not_found] if not convertible to a class *)
66 val class_of : env -> evar_map -> types -> types * cl_typ
67
68 val class_args_of : env -> evar_map -> types -> constr list
69
70 val subst_coercion : substitution -> coe_info_typ -> coe_info_typ
71
72 (** Set [update] to update an already declared coercion (default [false]). *)
73 val declare_coercion : env -> evar_map -> ?update:bool -> coe_info_typ -> unit
74
75 (** {6 Access to coercions infos } *)
76 val coercion_exists : coe_typ -> bool
77
78 val coercion_info : coe_typ -> coe_info_typ
79
80 val coercion_type : Environ.env -> Evd.evar_map -> coe_info_typ EConstr.puniverses -> EConstr.t
81
82 (** {6 Lookup functions for coercion paths } *)
83
84 (** @raise Not_found in the following functions when no path exists *)
85
86 (** given one (or two) types these function also return the class (classes)
87 of the type and its class_args_of *)
88
89 val lookup_path_between_class : cl_typ * cl_typ -> inheritance_path
90 val lookup_path_between : env -> evar_map -> src:types -> tgt:types ->
91 inheritance_path
92 val lookup_path_to_fun_from : env -> evar_map -> types -> inheritance_path
93 val lookup_path_to_sort_from : env -> evar_map -> types -> inheritance_path
94 val lookup_pattern_path_between :
95 env -> inductive * inductive -> (constructor * int) list
96
97 val path_is_reversible : inheritance_path -> bool
98
99 (**/**)
100 (* Crade *)
101 val install_path_printer :
102 ((cl_typ * cl_typ) * inheritance_path -> Pp.t) -> unit
103 val install_path_comparator :
104 (env -> evar_map -> cl_typ -> inheritance_path -> inheritance_path -> bool) -> unit
105 (**/**)
106
107 (** {6 This is for printing purpose } *)
108 val string_of_class : cl_typ -> string
109 val pr_class : cl_typ -> Pp.t
110 val inheritance_graph : unit -> ((cl_typ * cl_typ) * inheritance_path) list
111 val classes : unit -> cl_typ list
112 val coercions : unit -> coe_info_typ list
113
114 (** [hide_coercion] returns the number of params to skip if the coercion must
115 be hidden, [None] otherwise; it raises [Not_found] if not a coercion *)
116 val hide_coercion : coe_typ -> int option
117
118 module ClTypSet : CSet.ExtS with type elt = cl_typ
119
120 val reachable_from : cl_typ -> ClTypSet.t