coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] I do not really understand coq modules, any ideas?
- Date: Fri, 5 Nov 2021 10:03:05 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT skyskimmer.net; spf=Pass smtp.mailfrom=gaetan.gilbert AT skyskimmer.net; spf=None smtp.helo=postmaster AT relay11.mail.gandi.net
- Ironport-hdrordr: A9a23:3AWZIKppnWudW3DYrOZCHLYaV5oVeYIsimQD101hICG9Ffb4qynOppomPHDP+VIssR0b9exoW5PhfZq/z+8W3WB5B97LN2PbUQOTXeJfBODZrgEIdReQysdtkYlFN5JzAsHqDUVr5PyKhjVRWL4bsby6GOTCv5a480tQ
- Ironport-phdr: A9a23:aBcMxx0qADHFm9SIsmDOVAQyDhhOgF0UFjAc5pdvsb9SaKPrp82kYBaHo6Q0xwKWFazgqNt8w9LMtK7hXWFSqb2gi1slNKJ2ahkelM8NlBYhCsPWQWfyLfrtcjBoVJ8aDAwt8H60K1VaF9jjbFPOvHKy8SQSGhLiPgZpO+j5AIHfg9qr2+yo/5DffgpEiTq/bLhvMBi4sALdu9UMj4B/MKgx0BzJonVJe+RS22xlIE+Ykgj/6Mmt4pNt6jxctP09+cFOV6X6ZLk4QqdDDDs6KWA15dbkugfFQACS+3YTSGQWkh5PAwjY8BH3W4r6vyXmuuZh3iSRIMv7Rq02Vzu/9admUALmhjkJNzA582/ZhMJ/g61Zrx29qBJy2JLUbYKPOfZiYq/Qc9EXSGxcVchRTSxBBYa8YpMOAeUbIeFYs5Pyp10WohW/BAmsAPjgxSFShn/qwKY31OshHhvY0ww8Bd0Otm7YrNr0NKcWSu+60rPIzSnYYvNN2jf86JPIchMgofGJWLJ/b9DRxVMpFwzbklWdsIroNC6a2eoRqWaU9fZgVf6xhG49rQF8ujihy8Mxh4XXm48bxVPJ+CZkzIs0OdG1TEF2bMKrHZZUtCyXKYR4T8A8Tm9muSs317ILtJy0ciUO1Zgq2R3SZfOBfoOV4RzjTP6cLSlliH9nYr6yhQq+/VK9xuD+VcS4ykhGoyRYntTKq3sDzQbc6tKdRft45kqh2SiA1wTU6uxcO0A7i67bJIQhw7Iti5Yfq0HDETX3mEXylqOWeV8r+u615OTmeLnmoIGTN5NshgH/NKQhhNC/DPwmPgQTXWWX4+ax2KH58UHkQrhHjec6nrfXvZzHPcgbo7S2Aw5R0oYt8Ra/CDKm3cwXnXYdMl1FZAiIj47zN1HBIfD4CeywjEq2kDd33P3GJb7hA5XWLnjAkbfheLN95FBGyAYpy9BQ+Y5UBqkbIP3vQk/xqMDYDhghPgOoxObnEcxx2Z8aWWKSGaCUK7jSsF+N5uI3OeaAfo4VuDDnK/gk/fHil3E5mUVONZWuiJAQcTWzGulsC0Sfe3vlxNkbQkkQuQ9rY+VplFSEZhFSY3y/Rb50sj4yBZ6vC8HMR4Snjaad9Dy4D4ZVZ2VDB0rKF3r0IdbXE8wQYT6fd5cy2gcPUqKsHtdJPfCGrgL+wqs+d6zR8ywc853q0tR0oeveiUNqndSbJ9+ewnqOTmRxk3lOQTIqjvkXSalV0VSSyqt5hvlVD5pV6u8bCm8H
NB it's not about importing, it's about functor application
Gaëtan Gilbert
On 05/11/2021 10:01, Chris Dams wrote:
Dear all,
In case anyone is interested in what I did after asking my question about
modules in this mailing list, I will describe the final solution that
I arrived at.
I tried both the solutions by Guillaume and by Madhukar and they both work
but also have some disadvantages. In the end I ended up going with my
own solution (Example-2 in the original post) but basically turning the chain
of modules that import each other into an implementation detail. I renamed
some of the files involved adding '_internal' to their name in order to
indicate
that they are not meant to be used separately and added a facade file
that is just importing the whole chain but with a generic name suggesting
that it is the file that one is supposed to import as opposed to the other
internal ones. In future I could imagine putting the 'internal' files in a
subdirectory to further indicate their internal nature. Now my whole project
is compiling again, so I am happy :-).
The problem with Guillaumes solution is that while it works I really have to
pull out a lot of definitions out of my modules. It is not one
inductive definition
that needs to be pulled out of Module1 as in my example. It is 9 of them.
And then more inductive definitions from the other modules. Also, the
inductive
definitions in subsequent modules do not just refer to inductive definitions
in
the previous modules but also to ordinary definitions, which, as a result
would
also have to be pulled out of the module. At this point it gets quite
impractical.
Also, some of these inductive definitions are Records and then I have to not
just import the name of the Record but also the name of its constructor and
the names of its fields into the module and give all of these different names.
I prefixed the 'global' ones with a 'g' which is not very nice either.
The problem with Madhukars solution is that while it also works it has quite
a bit of syntactic overhead that is quite tricky that is not just in
the internal
files but also in the code that uses it. Because of this I decided in the end
to
put the modules behind the facade that I described above so code using this
can just Import one module and be done with it.
After looking into all of this I cannot really help feeling that the issue
that
importing a module with an inductive definition copies the inductive
definition
such there there are then two incompatible inductive types really should
be considered a bug in coq. I understand that the current way is the easiest
way to implement modules and I really do not know whether improving the
situation is possible but it just seems strange and highly impractical....
Kind Regards,
Chris
- [Coq-Club] I do not really understand coq modules, any ideas?, Chris Dams, 11/03/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Guillaume Melquiond, 11/03/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Madhukar, 11/03/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Raphaël Cauderlier, 11/03/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Chris Dams, 11/03/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Chris Dams, 11/05/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Gaëtan Gilbert, 11/05/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Sylvain Boulmé, 11/05/2021
- Re: [Coq-Club] I do not really understand coq modules, any ideas?, Chris Dams, 11/05/2021
Archive powered by MHonArc 2.6.19+.