Strategy#
Ltac2.Rewrite.Strategy
Module for rewrite strategies used by Rewrite.rewrite_strat.
type t = Rewrite.strategyval fail : tFailure.
val id : tSuccess without progress.
val refl : tSuccess with progress.
Fixed point operation for recursive strategies. fix (fun f -> s) evaluates to s [f / fix (fun f -> s)]. The function provided in the argument is executed only once when the strategy is constructed — it cannot be used to dynamically manage the rewriting.
Applies the argument to the leftmost immediate subterm of the considered term on which progress can be made.
Applies the argument to all immediate subterms of the considered term, left-to-right.
Traverses the term bottom-up, left-to-right and applies the argument at each step as many times as possible.
Traverses the term top-down, left-to-right and applies the argument at each step as many times as possible.
Traverses the term bottom-up, left-to-right until the argument makes progress.
Unifies one side of the lemma with the current subterm and on success rewrites it to the other side. If ltr is true, rewrites left-to-right; otherwise, rewrites right-to-left.
terms l is equivalent to choices (List.map (fun c -> one_lemma c ~ltr:true) l).
val eval : Redexpr.red_expr -> tConverts the term under consideration.
val tactic :
(constr -> constr -> constr option -> Rewrite.Result.t Proofview.tactic) ->
tThe tactic f strategy applies f to arguments ty, lhs and rel, where lhs is the subterm being rewritten, of type ty, and an optional relation constraint rel is given.
The tactic is applied to a single goal of type unit whose context corresponds to the context of the term to rewrite (i.e., the context of the goal at the start of the Rewrite.rewrite_strat call extended with the binders that were traversed to attain this subterm). The tactic should return a Rewrite.Result.t indicating success, failure or no progress and should not solve the goal. Solving the goal is an error that aborts the Rewrite.rewrite_strat call. The success record contains the chosen relation rel, new right-hand side rhs and a proof prf of rel t rhs.
If the proof prf is syntactically eq_refl _, then the witness of the rewriting is simply a conversion requiring no explicit proof and no congruence lemmas for the context of the rewrite.