| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
open Names |
| 12 |
open Constr |
| 13 |
open Evd |
| 14 |
open Environ |
| 15 |
open EConstr |
| 16 |
open Inductiveops |
| 17 |
open Glob_term |
| 18 |
open Evardefine |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
type pattern_matching_error = |
| 24 |
| BadPattern of constructor * constr |
| 25 |
| BadConstructor of constructor * inductive |
| 26 |
| WrongNumargConstructor of |
| 27 |
{cstr:constructor; expanded:bool; nargs:int; expected_nassums:int; expected_ndecls:int} |
| 28 |
| WrongNumargInductive of |
| 29 |
{ind:inductive; expanded:bool; nargs:int; expected_nassums:int; expected_ndecls:int} |
| 30 |
| UnusedClause of cases_pattern list |
| 31 |
| NonExhaustive of cases_pattern list |
| 32 |
| CannotInferPredicate of (constr * types) array |
| 33 |
|
| 34 |
exception PatternMatchingError of env * evar_map * pattern_matching_error |
| 35 |
|
| 36 |
val error_wrong_numarg_constructor : |
| 37 |
?loc:Loc.t -> env -> cstr:constructor -> expanded:bool -> nargs:int -> expected_nassums:int -> expected_ndecls:int -> 'a |
| 38 |
|
| 39 |
val error_wrong_numarg_inductive : |
| 40 |
?loc:Loc.t -> env -> ind:inductive -> expanded:bool -> nargs:int -> expected_nassums:int -> expected_ndecls:int -> 'a |
| 41 |
|
| 42 |
val irrefutable : env -> cases_pattern -> bool |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
val compile_cases : |
| 47 |
?loc:Loc.t -> program_mode:bool -> case_style -> |
| 48 |
(type_constraint -> GlobEnv.t -> evar_map -> glob_constr -> evar_map * unsafe_judgment) * evar_map -> |
| 49 |
type_constraint -> |
| 50 |
GlobEnv.t -> glob_constr option * tomatch_tuples * cases_clauses -> |
| 51 |
evar_map * unsafe_judgment |
| 52 |
|
| 53 |
val constr_of_pat : |
| 54 |
Environ.env -> |
| 55 |
Evd.evar_map -> |
| 56 |
rel_context -> |
| 57 |
Glob_term.cases_pattern -> |
| 58 |
Names.Id.Set.t -> |
| 59 |
Evd.evar_map * Glob_term.cases_pattern * |
| 60 |
(rel_context * constr * |
| 61 |
(types * Vars.substl) * Glob_term.cases_pattern) * |
| 62 |
Names.Id.Set.t |
| 63 |
|
| 64 |
type 'a rhs = |
| 65 |
{ rhs_env : GlobEnv.t; |
| 66 |
rhs_vars : Id.Set.t; |
| 67 |
avoid_ids : Id.Set.t; |
| 68 |
it : 'a option} |
| 69 |
|
| 70 |
type 'a equation = |
| 71 |
{ patterns : cases_pattern list; |
| 72 |
rhs : 'a rhs; |
| 73 |
alias_stack : Name.t list; |
| 74 |
eqn_loc : Loc.t option; |
| 75 |
orig : int option; |
| 76 |
catch_all_vars : Id.t CAst.t list } |
| 77 |
|
| 78 |
type 'a matrix = 'a equation list |
| 79 |
|
| 80 |
|
| 81 |
type tomatch_type = |
| 82 |
| IsInd of types * inductive_type * Name.t list |
| 83 |
| NotInd of constr option * types |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
type tomatch_status = |
| 92 |
| Pushed of (bool*((constr * tomatch_type) * int list * Name.t)) |
| 93 |
| Alias of (bool * (Name.t * constr * (constr * types))) |
| 94 |
| NonDepAlias |
| 95 |
| Abstract of int * rel_declaration |
| 96 |
|
| 97 |
type tomatch_stack = tomatch_status list |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
type pattern_history = |
| 102 |
| Top |
| 103 |
| MakeConstructor of constructor * pattern_continuation |
| 104 |
|
| 105 |
and pattern_continuation = |
| 106 |
| Continuation of int * cases_pattern list * pattern_history |
| 107 |
| Result of cases_pattern list |
| 108 |
|
| 109 |
type 'a pattern_matching_problem = |
| 110 |
{ env : GlobEnv.t; |
| 111 |
pred : constr; |
| 112 |
tomatch : tomatch_stack; |
| 113 |
history : pattern_continuation; |
| 114 |
mat : 'a matrix; |
| 115 |
caseloc : Loc.t option; |
| 116 |
casestyle : case_style; |
| 117 |
typing_function: type_constraint -> GlobEnv.t -> evar_map -> 'a option -> evar_map * unsafe_judgment } |
| 118 |
|
| 119 |
val compile : program_mode:bool -> evar_map -> 'a pattern_matching_problem -> |
| 120 |
(int option * Names.Id.t CAst.t list) list * evar_map * unsafe_judgment |
| 121 |
|
| 122 |
val prepare_predicate : ?loc:Loc.t -> program_mode:bool -> |
| 123 |
(type_constraint -> |
| 124 |
GlobEnv.t -> Evd.evar_map -> glob_constr -> Evd.evar_map * unsafe_judgment) -> |
| 125 |
GlobEnv.t -> |
| 126 |
Evd.evar_map -> |
| 127 |
(types * tomatch_type) list -> |
| 128 |
rel_context list -> |
| 129 |
constr option -> |
| 130 |
glob_constr option -> (Evd.evar_map * (Name.t * Name.t list) list * constr) list |
| 131 |
|
| 132 |
val make_return_predicate_ltac_lvar : GlobEnv.t -> Evd.evar_map -> Name.t -> |
| 133 |
Glob_term.glob_constr -> constr -> GlobEnv.t |