Say I have a lemma mylem: foo ?a = bar ?a
, and I need to apply it on a goal that has two occurrences of foo
, e.g. baz (foo (f p q)) (foo (g r s))
, but only at one of these positions. I know of two ways of doing that without having to write out all of p
,q
..., which can be complex expressions.
- Using
apply (subst mylem)
followed by an appropriate number (here, zero or one) ofback
commands. - Using
apply (subst mylem[where a = 'foo x y', standard])
, wherex
andy
are unbound names.
The use of subst
here is just for demonstration; I really do want to modify the lemma, e.g. to use it with rule
when there are multiple possible matches that I’d like to disambiguate this way.
Both approaches look like bad style to me. Is there a nicer way of achieving that?