I was testing Coq rewrite tactics modulo associativity and commutativity (aac_tactics
). The following example works for integer (Z
), but generates an error when integers are replaced by rationals (Q
).
Require Import ZArith.
Import Instances.Z.
Goal (forall x:Z, x + (-x) = 0)
-> forall a b c:Z, a + b + c + (-(c+a)) = b.
intros H ? ? ?.
aac_rewrite H.
When replacing Require Import ZArith.
with Require Import QArith.
etc., there is an error:
Error: Tactic failure: No matching occurence modulo AC found.
at aac_rewrite H.
There was a similar inconsistency issue between Z
and Q
, which turned out to be related to whether the Z
/Q
scope is open.
But I don't understand why aac rewrite didn't work here. What's the cause of the inconsistency, and how can one make it behave the same for Z
and Q
?