Skip to Content.
Sympa Menu

ssreflect - RE: [ssreflect] Canonical Structure not so canonical

Subject: Ssreflect Users Discussion List

List archive

RE: [ssreflect] Canonical Structure not so canonical


Chronological Thread 
  • From: Georges Gonthier <>
  • To: Florent Hivert <>
  • Subject: RE: [ssreflect] Canonical Structure not so canonical
  • Date: Mon, 9 May 2016 17:05:45 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:L+LeyxzvoMaP1SzXCy+O+j09IxM/srCxBDY+r6Qd0eIRIJqq85mqBkHD//Il1AaPBtWKrasewLOO7ejJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6DyZ3tnLnqpdX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4DfHShGC4GdUcmQInwBUS1zr6BbgU5Ht9Av7qOdnxAGeJ8ywQ6piChq46KI+ZxLvkigKLHYW92fLis19luoPrxWnuxx+zpT8ZYCeLv1lea3BO9gdQDwSDY5qSyVdD9bkPMM0BO0bMLMd9tGlqg==
  • Resent-date: Mon, 9 May 2016 19:24:27 +0200
  • Resent-from: Florent Hivert <>
  • Resent-message-id: <20160509172427.GA4806@siteswap>
  • Resent-to: "" <>
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:23

That was indeed just what I meant: a transparent definition, which lets you
silently convert values from the carrier to its alias. If you don't need or
want the silent conversion, then cloning the type (using a unary inductive)
will give you more stability, though.
Georges
(btw: this is now a private thread.)

-----Original Message-----
From: Florent Hivert
[mailto:]

Sent: 09 May 2016 17:56
To: Georges Gonthier
<>
Subject: Re: [ssreflect] Canonical Structure not so canonical

Hi Georges,

> I'd be wary of using vernacular side effects to juggle between
> alternative structures. The alternative used in mathcomp is to define
> an alias for the carrier type to bear the alternative structure, for
> example R^c for the converse ring in ssralg, or baseFieldType L in
> fieldext for L as a field over F in a tower of extensions F : K : L.

I'm note sure what you mean by "alias" ? Considering your divisibility
example, is it just writing something like

Definition nat_div := nat.

Fact div_porder : PartOrder.axiom (fun m n : nat_div => m %| n).
Definition nat_divdMixin := PartOrder.Mixin div_porder.
Canonical nat_divType := Eval hnf in POrdType nat_div nat_divMixin.

Or is it something more tricky involving locking ?

> This way of proceeding lets you specify the structure with a regular
> type cast (or variable type declaration), which I think is more
> natural. Of course you have to be wary of the ambiguity of the
> displayed terms (which omit casts and structure arguments); also,
> there are performance issues with Coq unification in fieldext
> (probably tied to the complexity of the structure, so less likely to affect
> you).

Actually I realized that I already hit this problem:

Lemma dual_leqX m n : (@leqX_op (dual_pordType T) m n) = (@leqX_op T n m).

Those kind of lemmas are a nightmare to prove because it prints as

(m <= n) = (n <= m)

with no clue for the actual order.

Thanks for the help,

Florent



Archive powered by MHonArc 2.6.18.

Top of Page