Module Constr_matching
This module implements pattern-matching on terms
val instantiate_pattern : Environ.env -> Evd.evar_map -> Ltac_pretype.extended_patvar_map -> Pattern.constr_pattern -> instantiated_pattern
type binding_bound_vars= Names.Id.Set.t
exceptionPatternMatchingFailurePatternMatchingFailureis the exception raised when pattern matching fails
val special_meta : Constr.metavariablespecial_metais the default name of the meta holding the surrounding context in subterm matching
type bound_ident_map= Names.Id.t Names.Id.Map.tbound_ident_maprepresents the result of matching binding identifiers of the pattern with the binding identifiers of the term matched
val matches : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> Ltac_pretype.patvar_mapmatches pat cmatchescagainstpatand returns the resulting assignment of metavariables; it raisesPatternMatchingFailureif not matchable; bindings are given in increasing order based on the numbers given in the pattern
val matches_head : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> Ltac_pretype.patvar_mapmatches_head pat cdoes the same asmatches pat cbut acceptspatto match an applicative prefix ofc
val extended_matches : Environ.env -> Evd.evar_map -> (binding_bound_vars * instantiated_pattern) -> EConstr.constr -> bound_ident_map * Ltac_pretype.extended_patvar_mapextended_matches pat calso returns the names of bound variables incthat matches the bound variables inpat; if several bound variables or metavariables have the same name, the metavariable, or else the rightmost bound variable, takes precedence
val is_matching : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> boolis_matching pat cjust tells ifcmatches againstpat
val is_matching_head : Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> boolis_matching_head pat cjust tells ifcor an applicative prefix of it matches againstpat
val empty_context : contextval repr_context : context -> EConstr.tval instantiate_context : context -> EConstr.t -> EConstr.t
type matching_result={m_sub : bound_ident_map * Ltac_pretype.patvar_map;m_ctx : context;}The type of subterm matching results: a substitution + a context (whose hole is denoted here with
special_meta)
val match_subterm : Environ.env -> Evd.evar_map -> (binding_bound_vars * instantiated_pattern) -> EConstr.constr -> matching_result IStream.tmatch_subterm pat creturns the substitution and the context corresponding to each **closed** subterm ofcmatchingpat, considering application contexts as well.
val is_matching_appsubterm : ?closed:bool -> Environ.env -> Evd.evar_map -> Pattern.constr_pattern -> EConstr.constr -> boolis_matching_appsubterm pat ctells if a subterm ofcmatches againstpattaking partial subterms into consideration