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: Florent Hivert <>
  • To: Georges Gonthier <>
  • Subject: Re: [ssreflect] Canonical Structure not so canonical
  • Date: Mon, 9 May 2016 18:56:03 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:AbL7/BzGV72EGOjXCy+O+j09IxM/srCxBDY+r6Qd0eIRIJqq85mqBkHD//Il1AaPBtWKrasewLOO7ejJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6DyZ3tnLnqpdX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4DbOShGA62BUfWIQjhpJDhKNuB79WIvxsybgnu980zOdJsr4UfY/XjH0vIlxTxq9piMALTM/7Cn3i9J9lr4T9DyloAZyxZKSQICLOeBiVqfHfJUUXzwSDY5qSyVdD9bkPMM0BO0bMLMd9tGlqg==
  • Resent-date: Mon, 9 May 2016 19:04:46 +0200
  • Resent-from: Florent Hivert <>
  • Resent-message-id: <20160509170446.GA4389@siteswap>
  • Resent-to: "" <>

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