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: Tej Chajed <tchajed AT mit.edu>
- To: coq-club <coq-club AT inria.fr>, "Soegtrop, Michael" <michael.soegtrop AT intel.com>
- 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 13:16:13 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tchajed AT mit.edu; spf=Pass smtp.mailfrom=tchajed AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-6.mit.edu
- Ironport-phdr: 9a23:6+42qhblisp6N7zmeDoGpIb/LSx+4OfEezUN459isYplN5qZpM2+bnLW6fgltlLVR4KTs6sC0LqH9f2xEjVYsN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDjvcCCKFwQ1XKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGY2zRakzTKRZATI6KCh1oZSz7ViQBTeIs3AbSyAdlgdCS1zO6wi/VZPsuAP7sPB80W+UJ5uyBfoPXjmt871sUFugrSYMNzc09Cuf3slxh6JSrRbnvBtyzJLOZ5m9Nfxic6ebdtQfEzlvRMFUAhBMAMuXb4INAuZJafpTr4D/qlcmqBqiQwSgGbW8mXdzmnbq0PhigKwaGgbc0VllRopWvQ==
You can also prove it directly fairly easily, still relying on Nat.eqb_eq. I think this is quite similar in spirit to Emilio's ssreflect proof.
Lemma eqb_equiv : Equivalence (fun m n => Nat.eqb m n = true).
Proof.
constructor; repeat intro;
rewrite Nat.eqb_eq in *;
congruence.
Qed.
On Thu, Jun 2, 2016 at 1:03 PM, Emilio Jesús Gallego Arias <e+coq-club AT x80.org> wrote:
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
- [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Emilio Jesús Gallego Arias, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Tej Chajed, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Arnaud Spiwack, 06/02/2016
- RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Arnaud Spiwack, 06/02/2016
- RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Abhishek Anand, 06/02/2016
- RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/02/2016
- RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/03/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Abhishek Anand, 06/03/2016
- [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/03/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Abhishek Anand, 06/03/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Abhishek Anand, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Tej Chajed, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Jonathan Leivent, 06/02/2016
- RE: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Soegtrop, Michael, 06/02/2016
- Re: [Coq-Club] Elegant way to show Equivalence (fun m n => Nat.eqb m n = true) from standard library lemmas?, Emilio Jesús Gallego Arias, 06/02/2016
Archive powered by MHonArc 2.6.18.