Debian Codegraph @

kernel/modops.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 Constr
13 open Environ
14 open Declarations
15 open Mod_declarations
16 open Entries
17 open Mod_subst
18
19 (** {6 Various operations on modules and module types } *)
20
21 (** Functors *)
22
23 val is_functor : ('ty,'a) functorize -> bool
24
25 val destr_functor : ('ty,'a) functorize -> MBId.t * 'ty * ('ty,'a) functorize
26
27 val destr_nofunctor : ModPath.t -> ('ty,'a) functorize -> 'a
28
29 val check_modpath_equiv : env -> ModPath.t -> ModPath.t -> unit
30
31 val annotate_module_expression : module_expression -> module_signature ->
32 (module_type_body, (constr * UVars.AbstractContext.t option) module_alg_expr) functorize
33
34 val annotate_struct_body : structure_body -> module_signature -> module_signature
35
36 (** {6 Substitutions } *)
37
38 val subst_signature : substitution -> ModPath.t -> module_signature -> module_signature
39 val subst_structure : substitution -> ModPath.t -> structure_body -> structure_body
40
41 (** {6 Adding to an environment } *)
42
43 val add_structure :
44 ModPath.t -> structure_body -> delta_resolver -> env -> env
45
46 (** adds a module and its components, but not the constraints *)
47 val add_module : ModPath.t -> module_body -> env -> env
48
49 (** same as add_module, but for a module whose native code has been linked by
50 the native compiler. The linking information is updated. *)
51 val add_linked_module : ModPath.t -> module_body -> link_info -> env -> env
52
53 (** add an abstract module parameter to the environment *)
54 val add_module_parameter : MBId.t -> module_type_body -> env -> env
55
56 val add_retroknowledge : Retroknowledge.action list -> env -> env
57
58 (** {6 Strengthening } *)
59
60 val strengthen : module_type_body -> ModPath.t -> module_type_body
61
62 val strengthen_and_subst_module_body : ModPath.t -> module_body -> ModPath.t -> bool -> module_body
63
64 val subst_modtype_signature_and_resolver : ModPath.t -> ModPath.t ->
65 module_signature -> delta_resolver -> module_signature * delta_resolver
66
67 (** {6 Building map of constants to inline } *)
68
69 val inline_delta_resolver :
70 env -> inline -> ModPath.t -> MBId.t -> module_type_body ->
71 delta_resolver -> delta_resolver
72
73 (** {6 Cleaning a module expression from bounded parts }
74
75 For instance:
76 functor(X:T)->struct module M:=X end)
77 becomes:
78 functor(X:T)->struct module M:=<content of T> end)
79 *)
80
81 val clean_bounded_mod_expr : module_signature -> module_signature
82
83 (** {6 Errors } *)
84
85 type signature_mismatch_error =
86 | InductiveFieldExpected of mutual_inductive_body
87 | DefinitionFieldExpected
88 | ModuleFieldExpected
89 | ModuleTypeFieldExpected
90 | NotConvertibleInductiveField of Id.t * (env * types * types) option
91 | NotConvertibleConstructorField of Id.t * (env * types * types) option
92 | NotConvertibleBodyField of (env * constr * constr) option
93 | NotConvertibleTypeField of env * types * types
94 | CumulativeStatusExpected of bool
95 | PolymorphicStatusExpected of bool
96 | NotSameConstructorNamesField of Id.t array * Id.t array
97 | NotSameInductiveNameInBlockField of Id.t * Id.t
98 | FiniteInductiveFieldExpected of bool
99 | InductiveNumbersFieldExpected of { got : int; expected : int }
100 | InductiveParamsNumberField of { got : int; expected : int }
101 | RecordFieldExpected of bool
102 | RecordProjectionsExpected of { expected : Name.t list; got : Name.t list }
103 | NotEqualInductiveAliases of MutInd.t * MutInd.t
104 | IncompatibleUniverses of { err : UGraph.univ_inconsistency; env : env; t1 : types; t2 : types }
105 | IncompatibleQualities of { err : QGraph.elimination_error; env : env; t1 : types; t2 : types }
106 | IncompatiblePolymorphism of env * types * types
107 | IncompatibleUnivConstraints of { got : UVars.AbstractContext.t; expect : UVars.AbstractContext.t }
108 | IncompatibleVariance
109 | NoRewriteRulesSubtyping
110
111 type with_constraint_error =
112 | WithSignatureMismatch of signature_mismatch_error
113 | WithCannotConstrainPrimitive
114 | WithCannotConstrainSymbol
115
116 type subtyping_trace_elt =
117 | Submodule of Id.t
118 | FunctorArgument of int
119
120 type module_typing_error =
121 | SignatureMismatch of subtyping_trace_elt list * Id.t * signature_mismatch_error
122 | LabelAlreadyDeclared of Id.t
123 | NotAFunctor
124 | IsAFunctor of ModPath.t
125 | IncompatibleModuleTypes of module_type_body * module_type_body
126 | NotEqualModulePaths of ModPath.t * ModPath.t
127 | NoSuchLabel of Id.t * ModPath.t
128 | NotAModuleLabel of Id.t
129 | NotAConstant of Id.t
130 | IncorrectWithConstraint of Id.t * with_constraint_error
131 | GenerativeModuleExpected of Id.t
132 | LabelMissing of Id.t * string
133 | IncludeRestrictedFunctor of ModPath.t
134
135 exception ModuleTypingError of module_typing_error
136
137 val error_existing_label : Id.t -> 'a
138
139 val error_incompatible_modtypes :
140 module_type_body -> module_type_body -> 'a
141
142 val error_signature_mismatch :
143 subtyping_trace_elt list -> Id.t -> signature_mismatch_error -> 'a
144
145 val error_no_such_label : Id.t -> ModPath.t -> 'a
146
147 val error_not_a_module_label : Id.t -> 'a
148
149 val error_not_a_constant : Id.t -> 'a
150
151 val error_incorrect_with_constraint : Id.t -> with_constraint_error -> 'a
152
153 val error_generative_module_expected : Id.t -> 'a
154
155 val error_no_such_label_sub : Id.t -> string -> 'a
156
157 val error_include_restricted_functor : ModPath.t -> 'a