### 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

Idiomatically expressing “The Following Are Equivalent” in Coq

What are the possible ways to define parallel composition in Coq apart from using list?

Defining a finite automata Coq

Proving even + even = even with mutual induction using tactics

Rewriting hypothesis with a more concrete expression

Coq rewriting using lambda arguments

How to rewrite a goal using function definition?

coqtop -lv (version 8.6) no longer displaying proof subgoals?

Coq beginner - Prove a basic lemma

How to do induction differently?

Is is possible to implement a Coq tactic that inspects a HintDb? If so, how?

Need help on proving proposition in Coq

Folding back after unfolding

Could coq derive this solution automatically? Can coq manipulate algebraic expressions when performing the search for a proof?

A special case of Lob's theorem using Coq

How can I implement a coq tactic that iterates over the hypotheses?