Skip to Content.
Sympa Menu

coq-club - RE: [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

RE: [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: Emilio Jesús Gallego Arias <e+coq-club AT x80.org>
  • Cc: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?
  • Date: Thu, 2 Jun 2016 17:17:49 +0000
  • Accept-language: de-DE, en-US
  • Authentication-results: mail3-smtp-sop.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:a1cOzBe52ZSYVqmSlMLmHfWplGMj4u6mDksu8pMizoh2WeGdxc6yZR7h7PlgxGXEQZ/co6odzbGG4ua9CCdZucfJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviqtuOMk4R3Gv1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GJFdDTAnNFcX6dZ5ri7sRA+L63QbZUwMkxNTS1zIrxr9R9L6tjbwnvotgG+dJ8KgHp4uXjH3pZxsRRD0kiAfc3Yc8WrXg8F0xuoPpROqpxVyx8jPZ4yaKOB5Zovce88XQSxKWcMHBH8JOZ+1c4ZaV7lJBu1ftYSo/1Y=

Dear Emilio,

thanks for your suggestion! I considered moving to ssreflect several times,
maybe I should.

My larger goal is to create order structures (like TotalOrder) from user
supplied types and boolean comparison operators in a reasonably efficient
way. Using Nat.eqb was just an example. I am interested in elegant proof
techniques for such kind of goals, but not so much in this specific goal.

Best regards,

Michael

-----Original Message-----
From: Emilio Jesús Gallego Arias
[mailto:e+coq-club AT x80.org]

Sent: Thursday, June 2, 2016 7:04 PM
To: Soegtrop, Michael
<michael.soegtrop AT intel.com>
Cc:
coq-club AT inria.fr
Subject: Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m
n = true) from standard library lemmas?

Dear Michael,

"Soegtrop, Michael"
<michael.soegtrop AT intel.com>
writes:

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

I am not sure what you intend to prove, but here's a different proof your
result (using ssreflect's == equality instead of Nat.eqb).

From mathcomp
Require Import ssreflect ssrbool ssrnat eqtype ssrfun seq.
Require Export Relations Morphisms Setoid Equalities.

Lemma eqb_equiv : Equivalence (fun m n : nat => m == n).
Proof.
constructor.
- exact: eqxx.
- by move=> x y; rewrite eq_sym.
- by move=> x y z /eqP->.
Qed.

Best,
Emilio
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