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: e+coq-club AT x80.org (Emilio Jesús Gallego Arias)
  • To: "Soegtrop\, Michael" <michael.soegtrop AT intel.com>
  • Cc: "coq-club\@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, 02 Jun 2016 20:16:17 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=e+coq-club AT x80.org; spf=Neutral smtp.mailfrom=e+coq-club AT x80.org; spf=None smtp.helo=postmaster AT boipeva.ensmp.fr
  • Ironport-phdr: 9a23:j6UTbR3HxiP/y6Y5smDT+DRfVm0co7zxezQtwd8ZsekWLvad9pjvdHbS+e9qxAeQG96LurQZ2qGP6vCocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC3oLqhqvros2bSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskyJdgyC6WcGVX0i1lJtAgPF5Rz+FN+ltyrxtuNw3G+BOsD5UaozQRyj6btmTFnjjyJRZBAj92SCh497i7seqxa8rTRvk9aSZ5uafLpTe6LZfNRSZ2dazN0ZeCVFBo6zaMMmFesIJqcL/MHGu1ISoE7mVkGXD+T1x2oN3yeu0A==
  • Organization: X80 Heavy Industries

Dear Michael,

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

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

You may be interested in Cyril's Cohen recent work.

https://github.com/Barbichu/finmap (see order.v) there.

The approach followed there (as well as in most of math-comp) is to
provide Canonical Structures for your orders and let Coq infer them when
needed, which is almost the same as type classes. Depending on what
you'd like to do this may work better or worse, as you've seen there are
many different styles.

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

> Say I have some type class structure T for a relation R, I know that
> relation R and S are equivalent (forall x y, R x y <-> S x y) and I
> want to derive structure T for S. Is there a generic way to do this
> for any structure T?

The way it is done in math-comp/ssreflect is indeed to provide
"builders" that take some proof of equivalence and indeed build the new
structure for S.

Quoting an example from the documentation:

(* PcanFinMixin fK == the Finite mixin for T, given f : T -> fT and g with fT
*)
(* a finType and fK : pcancel f g.
*)

So if you have a (partial) embedding from T to a finite type, then you
can equiv T with a finite type structure. Note that this approach may
not be the best if you still need to compute with the transported class.

Best regards,
Emilio



Archive powered by MHonArc 2.6.18.

Top of Page