fix(library/tactic/location): replace cache must not be used when only a subset of all occurrences should be replaced at replace_occurrences
This commit is contained in:
parent
bc8bb1dbd3
commit
d6958be7e7
2 changed files with 11 additions and 1 deletions
|
@ -113,6 +113,7 @@ deserializer & operator>>(deserializer & d, location & loc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
expr replace_occurrences(expr const & e, expr const & t, occurrence const & occ, unsigned idx) {
|
expr replace_occurrences(expr const & e, expr const & t, occurrence const & occ, unsigned idx) {
|
||||||
|
bool use_cache = occ.is_all();
|
||||||
unsigned occ_idx = 0;
|
unsigned occ_idx = 0;
|
||||||
return replace(e, [&](expr const & e, unsigned offset) {
|
return replace(e, [&](expr const & e, unsigned offset) {
|
||||||
if (e == t) {
|
if (e == t) {
|
||||||
|
@ -121,6 +122,6 @@ expr replace_occurrences(expr const & e, expr const & t, occurrence const & occ,
|
||||||
return some_expr(mk_var(offset+idx));
|
return some_expr(mk_var(offset+idx));
|
||||||
}
|
}
|
||||||
return none_expr();
|
return none_expr();
|
||||||
});
|
}, use_cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
9
tests/lean/run/rewrite5.lean
Normal file
9
tests/lean/run/rewrite5.lean
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import algebra.group
|
||||||
|
open algebra
|
||||||
|
|
||||||
|
variable {A : Type}
|
||||||
|
variable [s : group A]
|
||||||
|
include s
|
||||||
|
|
||||||
|
theorem mul.right_inv (a : A) : a * a⁻¹ = 1 :=
|
||||||
|
by rewrite ⟨-{a}inv_inv at {1}, mul.left_inv⟩
|
Loading…
Reference in a new issue