Subject: Ssreflect Users Discussion List
List archive
- From: Robbert Krebbers <>
- To: Assia Mahboubi <>,
- Subject: Re: [ssreflect] Unused Type field in packed classes
- Date: Sun, 21 Feb 2016 19:13:09 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:RZXl9R0ubvIw74+zsmDT+DRfVm0co7zxezQtwd8ZsekUIvad9pjvdHbS+e9qxAeQG96LtLQZ0KGP6/mocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0ILqjKvro8SbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzqVhCO7zM5W2UclQdCAkCRxQrhX563lyL6vO1g0iiyPMvsTLlyVy70q+9wUwXlhiMKPCIR9XrNz812lqNS5hOnvR12hYDOM6+PM/8rRKTXd94AWSJiRMtbXSFbGcvoaoIOC+sHMuJZtJXmj0EJpxGzHxWvHu7lwDJSnTnw2ftpgKwaDQja0Vl4TJo1u3POoYCwbf9KXA==
Dear Assia,
thank you very much for the answer. Since this seems to be a recurring question, it may be nice to add this as a comment to eqtype.v (where this idiom occurs first).
Best,
Robbert
On 02/21/2016 07:04 PM, Assia Mahboubi wrote:
Hello Robbert,
sorry, we hit again the issue of the archives of the list not being
indexed by
search engines...
Christian Doczkal asked the very same question a while ago:
https://sympa.inria.fr/sympa/arc/ssreflect/2013-11/msg00010.html
and the thread includes answers by Laurent Théry and Georges Gonthier.
In short, all the instances built to inhabit `type` pack a redundant copy on
their first argument (sort) as their third (for the anonymous field).
The reason is that in Coq, several strategies can be applied to compare terms
that are constants applied to some arguments. Some (type inference,
unification)
compare arguments left-to-right, and others (kernel) right-to-left.
So the anonymous field is here to ensure that whatever strategy is applied,
sorts are compared first when comparing two instances of a same structure.
Indeed the strategy can otherwise make a dramatic difference, as instances of
classes (the argument in the middle) can be huge terms. In the case when the
two
sorts are easily seen as distinct, the failure might take a much longer time
to
happen if you compare the classes first.
Hope this helps,
assia
Le 21/02/2016 18:29, Robbert Krebbers a écrit :
Hello list,
In structure declarations like eqType:
Structure type := Pack {sort; _ : class_of sort; _ : Type}.
What is the purpose of the third anonymous field "_ : Type"? Such a field
seems
to occur in all algebraic structures in the mathcomp hierarchy and also
appears
in the Zmodule example at page 7 of [1] but does not seem to be explained in
that paper.
Best,
Robbert
[1] Francois Garillot, Georges Gonthier, Assia Mahboubi, Laurence Rideau.
Packaging Mathematical Structures. 2009.
- [ssreflect] Unused Type field in packed classes, Robbert Krebbers, 02/21/2016
- Re: [ssreflect] Unused Type field in packed classes, Assia Mahboubi, 02/21/2016
- Re: [ssreflect] Unused Type field in packed classes, Robbert Krebbers, 02/21/2016
- Re: [ssreflect] Unused Type field in packed classes, Assia Mahboubi, 02/21/2016
Archive powered by MHonArc 2.6.18.