0

I have found the same problem when proving several lemmas: rules with an equality sometimes only work in one direction.

For instance, I'd like to use append_assoc to get from xs @ ys @ zs to (xs @ ys) @ zs, but since append_assoc is defined as (xs @ ys) @ zs = xs @ ys @ zs, I can't.

Is there any way to indicate I want to use some rule backwards?

Thanks in advance.

Darsen
  • 119
  • 6

1 Answers1

3

The rule with swapped left- and right-hand sides is obtained by applying an attribute symmetric to the original rule:

lemma "xs @ ys @ zs = (xs @ ys) @ zs"
  by (rule append_assoc [symmetric])
Alexander Kogtenkov
  • 5,770
  • 1
  • 27
  • 35