Debian Codegraph @

pretyping/pretype_errors.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 Evd
15 open EConstr
16 open Type_errors
17
18 (** {6 The type of errors raised by the pretyper } *)
19
20 type unification_error =
21 | OccurCheck of Evar.t * constr
22 | NotClean of existential * env * constr
23 | NotSameArgSize
24 | NotSameHead
25 | NoCanonicalStructure
26 | ConversionFailed of env * constr * constr
27 | IncompatibleInstances of env * existential * constr * constr
28 | MetaOccurInBody of Evar.t
29 | InstanceNotSameType of Evar.t * env * types option * types
30 | InstanceNotFunctionalType of Evar.t * env * constr * types
31 | UnifUnivInconsistency of UGraph.univ_inconsistency
32 | CannotSolveConstraint of evar_constraint * unification_error
33 | ProblemBeyondCapabilities
34
35 type position = (Id.t * Locus.hyp_location_flag) option
36
37 type position_reporting = (position * int) * constr
38
39 type subterm_unification_error = bool * position_reporting * position_reporting
40
41 type type_error = (constr, types, ERelevance.t) ptype_error
42
43 val of_type_error : Type_errors.type_error -> type_error
44
45 type pretype_error =
46 | CantFindCaseType of constr
47 (** Old Case *)
48
49 | ActualTypeNotCoercible of unsafe_judgment * types * unification_error
50 (** Type inference unification *)
51
52 | UnifOccurCheck of Evar.t * constr
53 (** Tactic Unification *)
54
55 | UnsolvableImplicit of Evar.t * unsolvability_explanation option
56 | CannotUnify of constr * constr * unification_error option
57 | CannotUnifyLocal of constr * constr * constr
58 | CannotUnifyBindingType of constr * constr
59 | CannotGeneralize of constr
60 | NoOccurrenceFound of constr * Id.t option
61 | CannotFindWellTypedAbstraction of constr * constr list * (env * pretype_error) option
62 | WrongAbstractionType of Name.t * constr * types * types
63 | AbstractionOverMeta of Name.t * Name.t
64 | NonLinearUnification of Name.t * constr
65 (** Pretyping *)
66 | VarNotFound of Id.t
67 | EvarNotFound of Id.t
68 | UnexpectedType of constr * constr * unification_error
69 | NotProduct of constr
70 | TypingError of type_error
71 | CantApplyBadTypeExplained of (constr,types) pcant_apply_bad_type * unification_error
72 | CannotUnifyOccurrences of subterm_unification_error
73 | UnsatisfiableConstraints of
74 (Evar.t * Evar_kinds.t) option * Evar.Set.t
75 (** unresolvable evar, connex component *)
76 | NotAllowedSProp
77 | NotAllowedElimination of bool * ESorts.t * inductive puniverses
78 | NotAllowedDependentElimination of bool * inductive
79
80 exception PretypeError of env * evar_map * pretype_error
81
82 val precatchable_exception : exn -> bool
83
84 (** Raising errors *)
85 val raise_type_error : ?loc:Loc.t -> env * evar_map * type_error -> 'a
86
87 val error_actual_type : ?loc:Loc.t -> ?info:Exninfo.info -> env -> evar_map ->
88 unsafe_judgment -> constr -> unification_error -> 'b
89
90 val error_actual_type_core : ?loc:Loc.t -> env -> evar_map -> unsafe_judgment -> constr -> 'b
91
92 val error_cant_apply_not_functional : ?loc:Loc.t -> env -> evar_map ->
93 unsafe_judgment -> unsafe_judgment array -> 'b
94
95 val error_cant_apply_bad_type : ?loc:Loc.t -> env -> evar_map -> ?error:unification_error ->
96 int * constr * constr -> unsafe_judgment -> unsafe_judgment array -> 'b
97
98 val error_case_not_inductive : ?loc:Loc.t -> env -> evar_map -> unsafe_judgment -> 'b
99
100 val error_ill_formed_branch : ?loc:Loc.t -> env -> evar_map -> constr -> pconstructor -> constr -> constr -> 'b
101
102 val error_number_branches : ?loc:Loc.t -> env -> evar_map -> unsafe_judgment -> int -> 'b
103
104 val error_ill_typed_rec_body : ?loc:Loc.t -> env -> evar_map -> int ->
105 Name.t binder_annot array -> unsafe_judgment array -> types array -> 'b
106
107 val error_elim_arity : ?loc:Loc.t -> env -> evar_map -> inductive puniverses -> constr -> ESorts.t option -> 'b
108
109 val error_not_a_type : ?loc:Loc.t -> env -> evar_map -> unsafe_judgment -> 'b
110
111 val error_assumption : ?loc:Loc.t -> env -> evar_map -> unsafe_judgment -> 'b
112
113 val error_cannot_coerce : ?loc:Loc.t -> env -> evar_map -> constr * constr -> 'b
114
115 (** {6 Implicit arguments synthesis errors } *)
116
117 val error_occur_check : ?loc:Loc.t -> env -> evar_map -> Evar.t -> constr -> 'b
118
119 val error_unsolvable_implicit : ?loc:Loc.t -> env -> evar_map -> Evar.t ->
120 unsolvability_explanation option -> 'b
121
122 val error_cannot_unify : ?loc:Loc.t -> env -> evar_map ->
123 ?reason:unification_error -> constr * constr -> 'b
124
125 val error_cannot_unify_local : ?loc:Loc.t -> env -> evar_map -> constr * constr * constr -> 'b
126
127 val error_cannot_find_well_typed_abstraction : ?loc:Loc.t -> env -> evar_map ->
128 constr -> constr list -> (env * pretype_error) option -> 'b
129
130 val error_wrong_abstraction_type : ?loc:Loc.t -> env -> evar_map -> Name.t -> constr -> types -> types -> 'b
131
132 val error_abstraction_over_meta : ?loc:Loc.t -> env -> evar_map -> Name.t -> Name.t -> 'b
133
134 val error_non_linear_unification : ?loc:Loc.t -> env -> evar_map -> Name.t -> constr -> 'b
135
136 (** {6 Ml Case errors } *)
137
138 val error_cant_find_case_type : ?loc:Loc.t -> env -> evar_map -> constr -> 'b
139
140 (** {6 Pretyping errors } *)
141
142 val error_unexpected_type : ?loc:Loc.t -> env -> evar_map -> constr -> constr -> unification_error -> 'b
143
144 val error_not_product : ?loc:Loc.t -> env -> evar_map -> constr -> 'b
145
146 val error_var_not_found : ?loc:Loc.t -> env -> evar_map -> Id.t -> 'b
147
148 val error_evar_not_found : ?loc:Loc.t -> env -> evar_map -> Id.t -> 'b
149
150 val error_not_allowed_sprop : ?loc:Loc.t -> env -> evar_map -> 'a
151
152 val error_not_allowed_elimination : ?loc:Loc.t -> env -> evar_map -> bool -> ESorts.t -> inductive puniverses -> 'a
153
154 val error_not_allowed_dependent_elimination : ?loc:Loc.t -> env -> evar_map -> bool -> inductive -> 'a
155
156 (** {6 Typeclass errors } *)
157
158 val unsatisfiable_constraints : env -> evar_map -> Evar.t option -> Evar.Set.t -> 'a
159
160 val unsatisfiable_exception : exn -> bool
161