Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?


Chronological Thread 
  • From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?
  • Date: Thu, 2 Jun 2016 16:40:18 +0000
  • Accept-language: de-DE, en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga09.intel.com
  • Ironport-phdr: 9a23:3DIw8BfKz7JsvL8hMIsGEoNilGMj4u6mDksu8pMizoh2WeGdxc69ZR7h7PlgxGXEQZ/co6odzbGG4ua9CCdRvt6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDjvcCCKFQXzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePFyRrtBST8iLmod5cvxtBCFQxHFri8XVXxTmR5VCSDE6gv7V9H/qH2pmPB63XzQBsr7QqwuXizmp4JqQx/hhSNNf2o88WrXg8F0yrlcrR29vRtn64/SfIyRcvF5e/WOLpshWWNdU5MJBGR6CYSmYt5XAg==

Dear Coq Users,

 

sometimes I am struggling a bit with type classes. I wonder if there is an elegant way to show:

 

Lemma eqb_equiv : Equivalence (fun m n => Nat.eqb m n = true).

 

This would follow easily from Nat.eq_equiv and Nat.eqb_eq, if I could rewrite with Nat.eqb_eq under the lambda. I tried setoid_rewrite like this:

 

Require Export Relations Morphisms Setoid Equalities.

Require Import Arith.

Lemma eqb_equiv : Equivalence (fun m n => Nat.eqb m n = true).

Proof.

  setoid_rewrite Nat.eqb_eq.

 

But I don’t quite understand what to supply to get rid of the resulting error message:

 

Error: setoid rewrite failed: Unable to satisfy the following constraints:

In environment:

do_subrelation := Morphisms.do_subrelation : apply_subrelation

 

?p : "@Proper (forall _ : relation nat, Prop)

        (@respectful (relation nat) Prop

           (@pointwise_relation nat (forall _ : nat, Prop)

              (@pointwise_relation nat Prop iff)) (@Basics.flip Prop Prop Prop Basics.impl))

        (@Equivalence nat)"

 

The description in the manual is a bit too short for me to understand it.

 

Or is there a more elegant way to prove this without a rewrite under the binder?

 

Or is there already an instance for this in the library?

 

Thanks & best regards,

 

Michael

 

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928




Archive powered by MHonArc 2.6.18.

Top of Page