Skip to Content.
Sympa Menu

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

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] more naive questions about rewriting


Chronological Thread 
  • From: Vadim Zaliva <vzaliva AT cmu.edu>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] more naive questions about rewriting
  • Date: Tue, 16 Aug 2016 14:32:06 -0700
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=vadim.zaliva AT west.cmu.edu; spf=Pass smtp.mailfrom=vadim.zaliva AT west.cmu.edu; spf=None smtp.helo=postmaster AT mail-wm0-f42.google.com
  • Ironport-phdr: 9a23:P6mLnxyEZ9fwusvXCy+O+j09IxM/srCxBDY+r6Qd0e8XIJqq85mqBkHD//Il1AaPBtSCrasbwLOL7+igATVGusfZ9ihaMdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oMyKJVwXz2PgPfsydEzw9lSJ8JFOwMNLEeUY8lPxuHxGeuBblytDBGm4uFLC3Pq254Np6C9KuvgspIZqWKT+eLkkH/QDVGx1ezN92Mq+vh7aCACL+3E0U2MMkxMODRKWwgv9W8LPuyf7s6JP0S2bI8S+Ga4mUDCj8a5DQxr1zioLKmhqoynslsVsgfcD81qarBtlztuMbQ==


I have more questions about 'rewrite' tactics. Here is an artificial example, which illustrates what I am trying to do. I need to rewrite a part of an _expression_ under Leibnitz equality.


Require Import Coq.Program.Basics.
Require Import Coq.Program.Combinators.
Require Import Coq.Setoids.Setoid.

Unset Printing Notations.

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.
  (* I know, `using reflexivity` works here, but I want to prove by rewriting *)

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

  (* However, the following works OK. *)
  replace (compose f2 (compose f3 f4)) with (compose (compose f2 f3) f4)
    by apply compose_assoc.

  reflexivity.
Qed.

The equation I am working with are actually much more elaborate than one above, and rewriting parts of it using 'replace' makes my proofs difficult to read.I have to copy-paste ~100 line expressions into 'replace' arguments.

I would love to be able to rewriting positionally, using something like 'rewrite lemma at 2.' If standard rewrite tactics, does not allows this, perhaps it could be automated somehow?

--
CMU ECE PhD candidate
Mobile: +1(510)220-1060




Archive powered by MHonArc 2.6.18.

Top of Page