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:
Leonardo de Moura 2015-02-05 10:50:40 -08:00
parent bc8bb1dbd3
commit d6958be7e7
2 changed files with 11 additions and 1 deletions

View file

@ -113,6 +113,7 @@ deserializer & operator>>(deserializer & d, location & loc) {
}
expr replace_occurrences(expr const & e, expr const & t, occurrence const & occ, unsigned idx) {
bool use_cache = occ.is_all();
unsigned occ_idx = 0;
return replace(e, [&](expr const & e, unsigned offset) {
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 none_expr();
});
}, use_cache);
}
}

View 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⟩