Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] typeclasses and rewriting

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] typeclasses and rewriting


Chronological Thread 
  • From: Abhishek Anand <abhishek.anand.iitg AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] typeclasses and rewriting
  • Date: Thu, 28 Apr 2016 13:20:39 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=abhishek.anand.iitg AT gmail.com; spf=Pass smtp.mailfrom=abhishek.anand.iitg AT gmail.com; spf=None smtp.helo=postmaster AT mail-yw0-f174.google.com
  • Ironport-phdr: 9a23:Rhoz1RzJ5u1HufPXCy+O+j09IxM/srCxBDY+r6Qd0ewWIJqq85mqBkHD//Il1AaPBtWLraIYwLOO7OjJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6CyZTrnLnqpNX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqLjOq88ULYQWD8hKiU+4NDhnRjFVwqGoHUGBDY4iB1NViHP7BDhXpry+gL8v+xxkH2TN833VrA5WnKr6a5tRFnpiTsIHzE8+WDTzMd3ifQI81qauxVjztuMM8muP/1kc/aFcA==

Similar to what Jonathan is suggesting,
while rewriting with lemmas that have implicit arguments, or adding hints to a rewrite DB, I prepend "@" to prevent Coq from (I think) prematurely specializing the lemmas by instantiating the implicits. This helps in your case too, perhaps for a different reason.

 try rewrite @test_iff in *. (* succeeds *)




On Thu, Apr 28, 2016 at 1:02 PM, William Mansky <wmansky AT seas.upenn.edu> wrote:
Hello,

I've been trying to use typeclasses to carry around contexts of definitions and assumptions. Mostly, this works as I would like (i.e., as with locales in Isabelle), but I've run into some problems when proving an equation in one section and trying to rewrite with it in another. Here's a minimal example:

Require Import Setoid.

Class test := {A : Type; a : A; b : A; Heq : a = b}.

Section test.

Context {T : test}.

Lemma test_iff : forall c, a = c <-> b = c.
Proof.
  rewrite Heq; split; intro; auto.
Qed.

End test.

Section test2.

Context {T : test}.

Lemma test2 : forall d, a = d -> b = d.
Proof.
  intros.
  try rewrite test_iff in *. (* This doesn't work. *)
  rewrite test_iff in H. (* This does. *)
  auto.
Qed.

End test2.

This problem doesn't show up if both lemmas are in a single section, but I want to be able to use the same context across multiple files, so that doesn't really help. Does anyone have any suggestions?

Thanks,
William




Archive powered by MHonArc 2.6.18.

Top of Page