### coq

#### Re-writing without using symmetry tactic

This is the coq version I'm using: sibi { ~ }-> coqc --version The Coq Proof Assistant, version 8.4pl4 (November 2015) compiled on Nov 04 2015 12:56:53 with OCaml 4.02.3 This is the theorem I'm trying to prove: Require Import Coq.Lists.List. Import ListNotations. Theorem rev_app_distr: forall l1 l2 : list nat, rev (l1 ++ l2) = rev l2 ++ rev l1. Proof. Note that I will use this theorem in the proof (which has already been proved by me): Theorem app_nil_r : forall l : list nat, l ++ [] = l. Ok, now this is my attempt to prove the theorem via the usual induction way: Theorem rev_app_distr: forall l1 l2 : list nat, rev (l1 ++ l2) = rev l2 ++ rev l1. Proof. intros l1 l2. induction l1 as [| n l1']. - simpl. rewrite -> app_nil_r with (l := rev l2) at 2. But on executing the rewrite tactic, it gives me the following error: Error: Tactic failure:Nothing to rewrite. But If I use symmetry tactic, I can actually prove it via the same code: Theorem rev_app_distr: forall l1 l2 : list nat, rev (l1 ++ l2) = rev l2 ++ rev l1. Proof. intros l1 l2. induction l1 as [| n l1']. - simpl. symmetry. rewrite -> app_nil_r with (l := rev l2) at 1. So, why does rewriting it without symmetry doesn't work ?

The problem is not that you were missing the symmetry call, but that you added the at 2 modifier when invoking the tactic. Since the goal at that point has only one occurrence of the left-hand side of app_nil_r (that is, rev l2 ++ []), the rewrite tactic gets confused and does not do anything. If you replace at 2 by at 1, or simply delete it, the problem goes away. You can learn more about the at modifier in the Coq manual.

### Related Links

What's the difference between revert and generalize tactics in Coq?

Let expression written as inductive relation

where is Coq aac_tactics installed?

example for introduction pattern (p1 & … & pn) does not work

What's the difference between logical (Leibniz) equality and local definition in Coq?

How to show that if squares are equal, then the operands are equal as well?

rewrite works for integer but not for rationals for Coq aac_tactics

How to use Coq aac tactics to prove equalities in the goal?

How do I prove 'S x > 0' from scratch in Coq?

Best way to handle (sub) types of the form `{ x : nat | x >= 13 /\ x <= 19 }`?

Proof of idempotence for a function clearing a list but one element

How to apply Fixpoint definitions within proofs in Coq?

Is one being penalized by using 'same_relation' (and possibly other library definitions)?

Refine and # (at) symbol in Coq 8.5pl1

Tactic to partially compute goal in Coq

Merge duplicate cases in match Coq