-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental Include #63
base: master
Are you sure you want to change the base?
Conversation
Here's the rendered version of the proposal: https://github.com/coq/ceps/blob/31bcb7d97621390f37929a908a8032ce153667ac/text/000-incremental-include.md |
This reminds me of the |
That captures to some degree what we're proposing. But note that So for example, in the module type:
where
(or similar). Then in a context like:
The
A similar substitution happens in types too.
I don't think
Here, it seems very convenient to be able to say:
The alternative without
which is admittedly better than copying all the definitions, but still tedious (because all of |
Your explanation is very clear, thanks. On this example it is easy to explain why
The first This seems a little fragile, sometimes dependencies are hidden in implicit arguments (which you don't see) or in proof terms generated by tactics which may change if you tune a hint here or there (again you don't see them). I'm not against such a thing, but it may not be the best practice in polished files. |
Yes, that's right. I agree that |
If an interface proves a large number of derived theorems, Moreover, I am not sure these hidden dependencies really cause a problem. If they do, another semantics is possible and would fix that altogether. Now, suppose that
I see two options for
Both options achieve the two goal In either case, what's the effect of expose
|
It seems UseAll is also available in interfaces. Sure, if you immediately implement it, you notice things changed. But my understanding is that you wanted to first build a bunch of interfaces and then parallelize implementation. Anyway, I'm not against it. I would somehow prefer a more explicit way to name a bunch of things (not a sub module, but something giving anyway a name to a bunch of entries, so that you could write I think we could (or better you guys) start with |
I see. My alternative proposal would implicitly group definitions by source-code order: basically, as-if everything after an axiom depended on it. Not sure if @gstew5 would like that, but today's a US holiday. Ah that's what I was missing: for And there are interesting usecases, where a Module Type Monoid.
Parameter monoid : monoidT.
(* Theory. *)
Parameter somethingElse : ...
Definition foo := body1. (* Does not use something else! *)
(* *)
End Monoid.
Module Type FieldMonoid.
Parameter field : fieldT.
Provide Definition monoid := ... (* Implement [monoid] in terms of [field]. *)
UseAll From Monoid.
Definition foo := body2. (* Will fail if [foo] was already [Use]d. Not syntactically equal to [body1], but maybe definitionally equal. *)
Provide somethingElse : ...
End FieldMonoid. I'd never do this example, but this is a common pattern with mixin modules/abstract classes: you can basically encode (non-destructive!) inheritance of abstract classes/mixin modules. |
The more I think about this, and the more I'm convinced it can be implemented in user space using Coq-Elpi (plus a few extra APIs which don't seem rocket science). This API is too weak, since it does not give you access to a proper name (a |
@gares I do have a (pretty sketchy) implementation of some of these features in coq-elpi (that prototype prompted this CEP, in fact). I'd characterize it as a very early prototype since it doesn't deal with things like inductives, etc. That said, the proposed features seem generally useful, and might be easier to implement directly in Coq. In my prototype, in a module type like:
I hack the
My current prototype has relations like:
After implementing the prototype once, I think it could be reimplemented in a nicer way if there were APIs for accessing the terms defined in a module type and for easily calculating dependencies between terms (as you're suggesting above, I think). |
This API is useful, but it didn't seem like there's currently a way to access the definitions of the terms given by |
Indeed, the API has to be changed to expose a list of
It is an alternative to your What is missing is that some objects (notations, hints...) do have names in Coq (internally) but I've never bound them to Elpi. I guess you may want to |
With Coq-Elpi, |
Yes you are correct, if you put the feature in the logic you can optimize that, but you wound need to check anyway that the captured variables have the correct type. No idea if this matters in practice. |
From @gstew5