Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] more naive questions about rewriting

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] more naive questions about rewriting


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] more naive questions about rewriting
  • Date: Tue, 16 Aug 2016 18:20:43 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f169.google.com
  • Ironport-phdr: 9a23:0sa09hFpJLiV8h6mFB+Gnp1GYnF86YWxBRYc798ds5kLTJ75osuwAkXT6L1XgUPTWs2DsrQf2rOQ6vCrATJIoc7Y9itTKNoUD15NoP5VtjRoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blItdazLE4Lfx/66y/q1s8WKJV4Z3XzkMfgqcl329VyX7ZhOx9M6a+4Y8VjgmjNwYeNYxGdldxq4vi3XwYOOxqNl6DlaoPk79sRNAu3QdqU8SqFEXnx9azhmrJ6jiR6WRgyWo3AYT28+kxxSAgGD4gupcI32t37Ysex0xCmTO4XSQLEqVDK+p/NpTxnpiyoDOjMR/2Tei8g2h6Ve9kHy7ydjypLZNdnGfMF1ebnQKIsX


[setoid_rewrite <-compose_assoc at 2] works in Vadim's example. The way that setoid_rewrite matches patterns is different from the way that rewrite matches patterns. I think that setoid_rewrite's method is more intuitive.

-- Jonathan


On 08/16/2016 05:53 PM, Laurent Thery wrote:

Hi

(* The following does not work. Error: Tactic failure: Nothing to
rewrite. *)
try rewrite <- compose_assoc at 2.

Unfortunately the rewrite _ at n, rewrite the nth occurrence of the first pattern that is found

Here is an example:

Goal forall (x y : nat), (x + 0) + (y + 0) + (x + 0) = 0.
intros.
rewrite <- plus_n_O at 2.

If you want to select a particular occurrence, one way is to instantiate the theorem enough to make it applicable only where you want.

In your example

Lemma Foo
{A:Type}
(f0 f1 f2 f3 f4: A->A)
:
compose f1 (compose f2 (compose f3 f4)) =
compose f1 (compose (compose f2 f3) f4).
Proof.
intros.
rewrite <- (compose_assoc _ _ _ _ _ _ f2).

or

Lemma Foo
{A:Type}
(f0 f1 f2 f3 f4: A->A)
:
compose f1 (compose f2 (compose f3 f4)) =
compose f1 (compose (compose f2 f3) f4).
Proof.
intros.
rewrite <- compose_assoc with (h := f2).







Archive powered by MHonArc 2.6.18.

Top of Page