Module Ssrmatching_plugin.Ssrmatching
type ssrtermkind=|InParens|WithAt|NoFlag|Cpatterntype cpattern={kind : ssrtermkind;pattern : Genintern.glob_constr_and_expr;interpretation : Geninterp.interp_sign option;}The type of context patterns, the patterns of the
settactic and:tactical. These are patterns that identify a precise subterm.
type ('ident, 'term) ssrpattern=|T of 'term|In_T of 'term|X_In_T of 'ident * 'term|In_X_In_T of 'ident * 'term|E_In_X_In_T of 'term * 'ident * 'term|E_As_X_In_T of 'term * 'ident * 'termAST for
rpattern(and consequentlycpattern)
type pattern={pat_sigma : Evd.evar_map;pat_pat : (EConstr.existential, EConstr.t) ssrpattern;}
val pp_pattern : Environ.env -> pattern -> Pp.t
type rpattern= (cpattern, cpattern) ssrpatternThe type of rewrite patterns, the patterns of the
rewritetactic. These patterns also include patterns that identify all the subterms of a context (i.e. "in" prefix)
val pr_rpattern : rpattern -> Pp.tval redex_of_pattern : pattern -> (Evd.evar_map * EConstr.t) optionExtracts the redex and applies to it the substitution part of the pattern.
- raises Anomaly
if called on
In_TorIn_X_In_T
val interp_rpattern : Environ.env -> Evd.evar_map -> rpattern -> patterninterp_rpattern ise gl rpat"internalizes" and "interprets"rpatin the currentLtacinterpretation signatureiseand tactic inputgl
val interp_cpattern : Environ.env -> Evd.evar_map -> cpattern -> (Genintern.glob_constr_and_expr * Geninterp.interp_sign) option -> patterninterp_cpattern ise gl cpat ty"internalizes" and "interprets"cpatin the currentLtacinterpretation signatureiseand tactic inputgl.tyis an optional type for the redex ofcpat
type occ= (bool * int list) optionThe set of occurrences to be matched. The boolean is set to true * to signal the complement of this set (i.e. {-1 3})
type subst= Environ.env -> EConstr.t -> EConstr.t -> int -> EConstr.tsubst e p t i.iis the number of binders traversed so far,pthe term from the pattern,tthe matched one
val eval_pattern : ?raise_NoMatch:bool -> Environ.env -> Evd.evar_map -> EConstr.t -> pattern option -> occ -> subst -> EConstr.teval_pattern b env sigma t pat occ substmapstcallingsubston everyoccoccurrence ofpat. Theintargument is the number of binders traversed. IfpatisNonethen then subst is called ont.tmust live inenvandsigma,patmust have been interpreted in (an extension of)sigma.- raises NoMatch
if
pathas no occurrence andbistrue(defaultfalse)
- returns
twhere alloccoccurrences ofpathave been mapped usingsubst
val fill_occ_pattern : ?raise_NoMatch:bool -> Environ.env -> Evd.evar_map -> EConstr.t -> pattern -> occ -> int -> EConstr.t Evd.in_evar_universe_context * EConstr.tfill_occ_pattern b env sigma t pat occ his a simplified version ofeval_pattern. It replaces alloccoccurrences ofpatintwith Relh.tmust live inenvandsigma,patmust have been interpreted in (an extension of)sigma.- raises NoMatch
if
pathas no occurrence andbistrue(defaultfalse)
- returns
the instance of the redex of
patthat was matched andttransformed as described above.
val fill_rel_occ_pattern : Environ.env -> Evd.evar_map -> EConstr.t -> pattern -> occ -> Evd.evar_map * EConstr.t * EConstr.tVariant of the above function where we fix
h := 1and returnredex_of_pattern patifpathas no occurrence.
val empty_tpatterns : Evd.evar_map -> tpatternsval mk_tpattern : ?p_origin:(ssrdir * EConstr.t) -> ?ok:(EConstr.t -> Evd.evar_map -> bool) -> rigid:(Evar.t -> bool) -> Environ.env -> EConstr.t -> ssrdir -> EConstr.t -> tpatterns -> tpatternsmk_tpattern env sigma0 sigma_p ok p_origin dir tcompiles a termtliving inenvsigma(an extension ofsigma0) intro atpattern. Thetpatterncan hold a (proof) termpand a dictiondir. Theokcallback is used to filter occurrences.- returns
the compiled
tpatternand itsevar_map
- raises UserEerror
is the pattern is a wildcard
type find_P= Environ.env -> EConstr.t -> int -> k:subst -> EConstr.tfindP env t i kis a stateful function that finds the next occurrence of a tpattern and calls the callbackkto map the subterm matched. Theintargument passed tokis the number of binders traversed so far plus the initial valuei.- returns
twhere the subterms identified by the selected occurrences of the patter have been mapped usingk
- raises NoMatch
if the raise_NoMatch flag given to
mk_tpattern_matcheristrueand if the pattern did not match
- raises UserEerror
if the raise_NoMatch flag given to
mk_tpattern_matcherisfalseand if the pattern did not match
type conclude= unit -> EConstr.t * ssrdir * (bool * Evd.evar_map * UState.t * EConstr.t)conclude ()asserts that all mentioned occurrences have been visited.- returns
the instance of the pattern, the evarmap after the pattern instantiation, the proof term and the ssrdit stored in the tpattern
- raises UserEerror
if too many occurrences were specified
val mk_tpattern_matcher : ?all_instances:bool -> ?raise_NoMatch:bool -> ?upats_origin:(ssrdir * EConstr.t) -> Evd.evar_map -> occ -> tpatterns -> find_P * concludemk_tpattern_matcher b o sigma0 occ sigma_tplistcreates a pair a functionfind_Pandconcludewith the behaviour explained above. The flagb(defaultfalse) changes the error reporting behaviour offind_Pif none of thetpatternmatches. The argumentocan be passed to tune theUserErroreventually raised (useful if the pattern is coming from the LHS/RHS of an equation)
val fill_occ_term : Environ.env -> Evd.evar_map -> EConstr.t -> occ -> (Evd.evar_map * EConstr.t) -> EConstr.t * EConstr.t
val do_once : 'a option Stdlib.ref -> (unit -> 'a) -> unitdo_once r fcallsfand updates the ref only once
val assert_done : 'a option Stdlib.ref -> 'aassert_done rreturn the content of r.- raises Anomaly
is r is
None
val unify_HO : Environ.env -> Evd.evar_map -> EConstr.constr -> EConstr.constr -> Evd.evar_mapval tag_of_cpattern : cpattern -> ssrtermkindSome more low level functions needed to implement the full SSR language on top of the former APIs
val loc_of_cpattern : cpattern -> Loc.t optionval id_of_pattern : Evd.evar_map -> pattern -> Names.Id.t optionval is_wildcard : cpattern -> boolval cpattern_of_id : Names.Id.t -> cpatternval pr_constr_pat : Environ.env -> Evd.evar_map -> Constr.constr -> Pp.tval pr_econstr_pat : Environ.env -> Evd.evar_map -> Evd.econstr -> Pp.tval debug : bool -> unitval ssrinstancesof : cpattern -> unit Proofview.tactic
module Internal : sig ... end