| 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 | |
| 12 | (** This file extends Matching with the main logic for Ltac's |
| 13 | (lazy)match and (lazy)match goal. *) |
| 14 | |
| 15 | |
| 16 | (** [t] is the type of matching successes. It ultimately contains a |
| 17 | {!Tacexpr.glob_tactic_expr} representing the left-hand side of the |
| 18 | corresponding matching rule, a matching substitution to be |
| 19 | applied, a context substitution mapping identifier to context like |
| 20 | those of {!Constr_matching.matching_result}), and a {!Constr.t} |
| 21 | substitution mapping corresponding to matched hypotheses. *) |
| 22 | type 'a t = { |
| 23 | subst : Constr_matching.bound_ident_map * Ltac_pretype.extended_patvar_map ; |
| 24 | context : Constr_matching.context Names.Id.Map.t; |
| 25 | terms : EConstr.constr Names.Id.Map.t; |
| 26 | lhs : 'a; |
| 27 | } |
| 28 | |
| 29 | |
| 30 | (** [match_term env sigma term rules] matches the term [term] with the |
| 31 | set of matching rules [rules]. The environment [env] and the |
| 32 | evar_map [sigma] are not currently used, but avoid code |
| 33 | duplication. *) |
| 34 | val match_term : |
| 35 | Environ.env -> |
| 36 | Evd.evar_map -> |
| 37 | EConstr.constr -> |
| 38 | (Constr_matching.binding_bound_vars * Pattern.constr_pattern, Tacexpr.glob_tactic_expr) Tacexpr.match_rule list -> |
| 39 | Tacexpr.glob_tactic_expr t Proofview.tactic |
| 40 | |
| 41 | (** [match_goal env sigma hyps concl rules] matches the goal |
| 42 | [hyps|-concl] with the set of matching rules [rules]. The |
| 43 | environment [env] and the evar_map [sigma] are used to check |
| 44 | convertibility for pattern variables shared between hypothesis |
| 45 | patterns or the conclusion pattern. *) |
| 46 | val match_goal: |
| 47 | Environ.env -> |
| 48 | Evd.evar_map -> |
| 49 | EConstr.named_context -> |
| 50 | EConstr.constr -> |
| 51 | (Constr_matching.binding_bound_vars * Pattern.constr_pattern, Tacexpr.glob_tactic_expr) Tacexpr.match_rule list -> |
| 52 | Tacexpr.glob_tactic_expr t Proofview.tactic |