coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Clément Pit-Claudel <cpitclaudel AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library
- Date: Wed, 30 Oct 2019 16:57:03 -0400
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=cpitclaudel AT gmail.com; spf=Pass smtp.mailfrom=cpitclaudel AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f181.google.com
- Ironport-phdr: 9a23:PHO8iRzDhOikeC3XCy+O+j09IxM/srCxBDY+r6Qd1O0WIJqq85mqBkHD//Il1AaPAdyArasc0KGP7/qocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmTSwbalvIBmqowjdudQajIR8Jq0s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlSEKPCM7/m7KkMx9lL9VrgyvpxJ/wIDabo+aO/V8cazBct0XXnZBU8VLWiBdHo+xYYkCAuwcNuhYtYn9oF4OoAOgCAmoHuTvzyFHhnnq3aIiyeohEB3G0BU+EtIKqnvUscj6O7kWUeuoy6TH0S3Db/JK2Tjh7IjHaA0hruySUrJ0asfRxkwvGBnEjlWUs4DqIzSV1uEUvmWd8uFuVvqvhnY5pw1tpjWj3MQhh4nTio4L1FzI6z91zJs2KNGlUEJ3fMCoHZhKuyyUK4d6WMcvT3t2tComyrALv4OwcjIQx5Q93RHfbuSKc4iW7RLnU+acOTJ4i2hkeLK7nhqy6EugxvDlWsm6zVpHrTdJnsPDtnAK0BzT5cyHReVn8ki93jaP0hjf6uBCIU8qiarWM4AtzqI0m5YJsknOHjX6lFvogKOIbEko5+ul5/n/brXjvJCcNot0ig/kMqQpn8yyGfg3MhAPX2iH5eu80Kfs/VDkT7pUiv07iabZsJXAKsQaoq61GRNa0oEm6xqnFTepzMwYnWUbLFJCYB+Ik4/pO0jXLP/kCfe/nk+jnSxwx/HGO73hGo/CImLCkLfnZ7Z96lRTxBA9zdBFtNpoDeQKJ+u2UUvsvvTZCAU4Okq62bXJEtJ4g6ga2GeCBLOuCKLO9HSM7/8jLu3EMIQNuSr2L/E46/PqpXA8kF4ZO6Ku2M1EOziDAv16LhDBMjLXidAbHDJS51tsfKnRkFSHFAVrSTO3VqM46Cs8Ddv/X4jGT4GpxreG2XXiR8AEViV9ElmJVEzQWcCEVvMLMnzAJ8ZglnkdVuHkRdZxjFehswj1z7chJe3RqHVB6cDTkeNt7uiWrikcsCRuBp3EgW6IRmBw2GgPQm1u0Q==
Hi Xavier,
Thanks for your reply.
On 2019-10-30 14:19, Xavier Leroy wrote:
> Structurally equal types are equal. What you mean is "two inductive types
> that have the same constructors with the same argument types", and the
> answer is no, it is not possible.
Thanks for the clarification.
> Not exactly what you describe, but "Extract Constant" and "Extract
> Inductive" could help.
> Consider:
>
> Inductive t := A | B (n: nat) | C (b: bool).
> Extract Inductive t => "Lib.t" [ "Lib.A" "Lib.B" "Lib.C" ].
>
> Then, t will be defined as an abbreviation for Lib.t, and the code for f
> will use constructors prefixed with Lib. That might do what you want.
The problem with this strategy is that I need to do the same trick not just
on `t`, but on any types used by `t`; otherwise the generated code will apply
Lib.B to its own copy of nat, rather than the one in the original library,
and OCaml will reject the application.
So, in your example, I'd need to add extraction commands for `nat` and `bool`
as well. In my case the types used in the ASTs are more complex, and that
task will introduce a mess of had-to-maintain extraction commands :/
> * Add unsafe casts and hope for the best, which I think should work
> fine, but won't detect issues like version mismatches between the FooBarBaz
> library used on the OCaml and the FooBar library used on the Coq side.
>
> Hmph. What's the point of proving code if you're adding unsafe casts in
> the end?
The extracted code is already full of Obj.magic, whose justification is
meta-theoretical, to pacify the OCaml typechecker; wouldn't these be of a
similar nature?
> Don't use unsafe casts :-)
Is there any way to make them safer? For example, can I use compiler
libraries to ensure that the two types are the same?
Hopefully I've been doing this all wrong, and there's an obvious solution
that I've missed ^^
Clément.
- [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Xavier Leroy, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Xavier Leroy, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Xavier Leroy, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Stefan Monnier, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Erik Martin-Dorel, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/30/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Matthieu Sozeau, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Matthieu Sozeau, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Clément Pit-Claudel, 10/31/2019
- Re: [Coq-Club] Separate/incremental extraction of parts of a Coq library, Xavier Leroy, 10/30/2019
Archive powered by MHonArc 2.6.18.