-
Notifications
You must be signed in to change notification settings - Fork 31
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
Bug minimizer #691
Comments
It seems to me that program slicing as done in minimization do belong as a separate tool from coq-lsp/Flèche. But indeed, coq-lsp / Flèche can provide much better support for the bug minimizer than what is actually done. For example, we can provide a structured document view, error resilience, more info about commands and their effects and dependencies. Moreover incremental checking should provide large performance gains in some cases. Also as coq-lsp can work over multiple documents, inlining requires is not often needed. For example, you could have a
When coq-lsp opens this file, it can split it server-side and work as if many files were found. |
@ejgallego The reason we inline requires however is so that we get a minimal .v file at the end. I'm not sure I understand your point with multiple documents? |
The feature I am envisioning here is we literally have a button: "Help, Coq is giving me an unexpected behaviour". We minimize and help the user produce an issue upstream. Of course none of this would be needed if Coq didn't have bugs, but that is not the reality. i think coq-lsp can save a lot of users a lot of time in this regard. |
See also JasonGross/coq-tools#56 The short answer is that I don't have time to work on this, alas.
The other big important pass is admitting the proofs of unneeded lemmas and definitions. Is there a reason to bundle this feature with coq-lsp rather than have it as a separate package built on top? I think minimization would go faster if we avoided inlining requires until after minimizing the file being required, both because the current implementation tries to remove things it's already tried to remove after inlining, which is only rarely useful, and because sometimes files cannot be inlined, but would be inlinable if some constructs were removed. See also JasonGross/coq-tools#102 A more minimal version of this feature could just aggregate the current file and its recursive dependencies in order into a .lv file and prompt the user to upload the file to a GitHub issue with This has the benefit of not making the user wait for hours without touching their project while the bug is minimized locally. |
So the minimizer doesn't need to do any split for
I am not sure if you are talking about error recovery or .lv files, but indeed, there are many good reasons for both to be in coq-lsp instead of externally. For .lv files mainly the main benefit is atomic and incremental, for error recovery, many heuristics are too dynamic so they need to be programmed (they don't have to be programmed in OCaml tho, we could use
This step should not be really needed, note that coq-lsp has pretty good error recovery, and moreover can indeed skip proofs, but what to do depends on the slicing algoritm used.
The way I would approach the problem is to define an abstract interface for the slicing algorithm, and then see if coq-lsp can provide the needed information for the algorithm to run. Info we have now (or would be easy to add) is:
Then we can provide quite custom diagnostics in terms of errors. |
Can we compute dependencies on hints and instances? |
I don't know, what are those? |
The part they depend as CIC terms, yes we can, using the same device than for lemmas. |
I was talking about @Alizter 's (apparent?) request to have bug minimization as part of coq-lsp. |
I think I misunderstood some of the earlier discussion.
I read that as "the minimisation stuff should live outside of coq-lsp". But really I see that the dependency analysis etc. will be something lsp can offer and the bug minimiser ought to use these features of coq-lsp to do its work. I guess this issue shoud rather be: Which features should we support in coq-lsp to make the job of the bug minimiser easy? I think what @ejgallego suggested above with the abstract interface is the direction we should go. |
We want to skip not just opaque proofs, but also transparent proofs that don't matter. (Otherwise minimization would not work well for, e.g., HoTT and UniMath.) The slicing algorithm is not very interesting, you just remove one block at a time sequentially in reverse order. A block is either a vernacular command (such as I guess with coq-lsp you want to do a tree-like removal: first try to remove everything in a file before removing it's contents; try removing sections and modules before removing their contents. In order for dependency information to be useful, you need to operate on statements, not CIC terms. A lemma depends on all tactics used to prove it, |
Ah, okay. The features are:
Nice to have:
|
coq-lsp
should have a functionality to create a minimal test case for a particular error similarly to the bug minimiser in coq-tools.The basic functionality would be to inline
Require
s. Remove any unnecessary vernac.coq-tools does this by checking a regexp of the error and rerunning coqc for each attempt. coq-lsp could do this without ever rerunning and instead of regexp we could simply check the hash of the object we are comparing.
cc @JasonGross who I believe considered working on something like this. Did the idea ever come to fruition?
The text was updated successfully, but these errors were encountered: