The rewrites
tactic. #
rw?
tries to find a lemma which can rewrite the goal.
rw?
should not be left in proofs; it is a search tool, like apply?
.
Suggestions are printed as rw [h]
or rw [←h]
.
Future work #
We could try discharging side goals via assumption
or solve_by_elim
.
Extract the lemma, with arguments, that was used to produce a RewriteResult
.
Equations
- Lean.Meta.RewriteResult.by? r = if Lean.Expr.isAppOfArity r.eqProof `Eq.ndrec 6 = true then some (Lean.Expr.getArg! r.eqProof 5 (Lean.Expr.getAppNumArgs r.eqProof)) else none
Instances For
Weight to multiply the "specificity" of a rewrite lemma by when rewriting forwards.
Equations
Instances For
Weight to multiply the "specificity" of a rewrite lemma by when rewriting backwards.
Equations
Instances For
Prepare the discrimination tree entries for a lemma.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Select =
and ↔
local hypotheses.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Insert a lemma into the discrimination tree.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct the discrimination tree of all lemmas.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Retrieve the current cache of lemmas.
- expr : Lean.Expr
The lemma we rewrote by. This is
Expr
, not just aName
, as it may be a local hypothesis. - symm : Bool
True
if we rewrote backwards (i.e. withrw [← h]
). - weight : Nat
The "weight" of the rewrite. This is calculated based on how specific the rewrite rule was.
- result : Lean.Meta.RewriteResult
The result from the
rw
tactic. Pretty-printed result.
- mctx : Lean.MetavarContext
The metavariable context after the rewrite. This needs to be stored as part of the result so we can backtrack the state.
Data structure recording a potential rewrite to report from the rw?
tactic.
Instances For
Update a RewriteResult
by filling in the rfl?
field if it is currently none
,
to reflect whether the remaining goal can be closed by with_reducible rfl
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pretty print the result of the rewrite, and store it for later use.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pretty print the result of the rewrite.
If this will be done more than once you should use prepare_ppResult
Equations
- One or more equations did not get rendered due to their size.
Instances For
Shortcut for calling solveByElim
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find lemmas which can rewrite the goal.
This core function returns a monadic list, to allow the caller to decide how long to search.
See also rewrites
for a more convenient interface.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find lemmas which can rewrite the goal, and deduplicate based on pretty-printed results.
Note that this builds a HashMap
containing the results, and so may consume significant memory.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find lemmas which can rewrite the goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
rw?
tries to find a lemma which can rewrite the goal.
rw?
should not be left in proofs; it is a search tool, like apply?
.
Suggestions are printed as rw [h]
or rw [←h]
.
Equations
- One or more equations did not get rendered due to their size.