coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
- To: Jim Fehrle <jim.fehrle AT gmail.com>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] singleton_class_definition leading ">"
- Date: Sun, 13 Jun 2021 15:37:42 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qv1-f46.google.com
- Ironport-hdrordr: A9a23:sa+zmaoPjEKV+UTirMmbxL0aV5o+eYIsimQD101hICG9vPb5qynOppkmPHDP5gr5NEtKpTnEAsi9qA3nn6KdkLN8AV7KZmCPhILrFvAB0WKI+VLd8kPFh41gPN9bAs1DNOE=
- Ironport-phdr: A9a23:dm7O4BfyOZM3zkpVZ6uKQ6GOlGM+09nLVj580XLHo4xHfqnrxZn+JkuXvawr0AaYG96BsLkd0beempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffgFFiCCzbL9sIhi6ohjdutcWjIB/Nqs/1xzFr2dSde9L321oP1WTnxj95se04pFu9jlbtuwi+cBdT6j0Zrw0QrNEAjsoNWA1/9DrugLYTQST/HscU34ZnQRODgPY8Rz1RJbxsi/9tupgxCmXOND9QL4oVTi+6apgVQTlgzkbOTEn7G7Xi9RwjKNFrxKnuxx/2JPfbIWMOPZjYq/RYdYWSGxcVchTSiNBGJuxYYUPAeQfIOhWrIvyp1UJoxSxGQaiC/jiyiNKi3LswaE3yfgtHR/A0Qc9H9wOqnPUrNDtOascU+C1y6/IzTTAb/xI3Tfy9pbHfwsuofGJR71wcM7RxVMzGAPCi1Wcp5HuMjSX1uQKtWib7ulgWvyri2E5tQ58uTevxsI2hYnIgoIZ0EzL9SJ8wIssI9CzVUF0b8K+HpRKqyGaK5V5QtkkQ2xwpCo3xaAKtYOlcSUKy5kqxBHSZuKJfYWH7BzuWuicLSl2iX9lZb+ymha8/Ea9xuDiWMe5zlVHoCRBn9fMtn4A1Bre4dWERPtl5kqtxyqD2gTJ5uxHIU04j7TXJ4Mlz7IqmZcesFzPEjH3lUnqkaObc1go9+y05Onibbjrp4OQO5NxhwzwM6khh8myDOA3PwUBRGeW/Pqz26ft/U33RbhKgOM5nrfEv53fO8gWqbS2DgxT340+8RiwFS2m384dnXQfLFJKZhaHj4/xNlHLOv/4DPO/j021kDd12vzKJ7PhD5rMI3TZn7fherF960FYyAUt19xQ+5VUCrQZLPLyXE/+qsDYAwcnPwCox+vrEtZw24MEVW6RH6OUNLnevFCJ6+43JumDfo4VuDLzK/g/4P7uiGc0mV0afamv3JsXa263HvB4LEqHenfsjdIBHn0Lvgo6VuDllFqCUTtLa3aoQ608/i07CJ6hDYrbWo+th6WB0D6nEZ1Se2BJEUuBEWzodoWBQ/cDcjieIs5nkjweVLiuUZUt1R+0tFyy970yDOvRsgMVtYjn2ZAh5ezW0x8/9SZwAuyS1miMSyd/mWZeFBEs26Uq6056zFaA3Kx1jtRXENVS47VCVQJwfcreyOp7CN32Vw/pcdKASVLgSdKjV2JiBuktysMDNh4uU+6piQrOim/zW+d9f12jAZU19ufFwSG0KZojjXnB06Ylgh8tRc4dbQVOaYZw8gHSA8jClEDLzs5CkIwT2SfM8CGIym/c5Cll
On Sun, 13 Jun 2021 12:03:01 -0700
Jim Fehrle <jim.fehrle AT gmail.com> wrote:
> Some clues:
> The ">" corresponds to the non-terminal "opt_coercion". The text
> describing "record_definition" in the doc describes how that works for
> records.
>
> [image: image.png]
That doc says:
> If provided, the constructor name is automatically declared as a
> coercion from the class of the last field type to the record name
> (this may fail if the uniform inheritance condition is not
> satisfied).
That does not seem like it would add additional behavior for a singleton
Class. A singleton class will already act as though there is a
coercion from the field to the class, because the field is not wrapped
in a record, and no constructor is needed.
Parameter T : Type.
Parameter a : T.
Class Foo := foo:T.
Definition f := let x:Foo := a in x. (*succeeds*)
Eval vm_compute in f. (*evaluates to a*)
Substituting record for class:
Record Foo := {foo:T}.
fails in the definition of f, but
Record >Foo := {foo:T}.
succeeds. So the leading ">" seems useful for records, but not for
singleton classes. Interestingly, it might be useful for classes that
are record definitions, but it doesn't work:
Class >Foo := {foo:T}.
is allowed, but fails in the definition of f above.
BTW: I'm testing this in 8.13.2.
- [Coq-Club] singleton_class_definition leading ">", jonikelee AT gmail.com, 06/13/2021
- Re: [Coq-Club] singleton_class_definition leading ">", Jim Fehrle, 06/13/2021
- Re: [Coq-Club] singleton_class_definition leading ">", jonikelee AT gmail.com, 06/13/2021
- Re: [Coq-Club] singleton_class_definition leading ">", Jim Fehrle, 06/13/2021
Archive powered by MHonArc 2.6.19+.