Skip to content
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

poor PG man's workaround for coq/coq#11479 #750

Merged
merged 9 commits into from
Apr 25, 2024

Conversation

hendriktews
Copy link
Collaborator

Work towards a feature that permits to extract lists of failing proofs from PG. Similar to what coq/coq#11479 would provide.

@hendriktews hendriktews force-pushed the proof-stat branch 2 times, most recently from ad39c0c to 69d65e2 Compare March 27, 2024 20:03
@hendriktews
Copy link
Collaborator Author

hendriktews commented Mar 27, 2024

@erikmd @Matafou maybe you are interested. To try it out navigate to ci/simple-tests/proof_stat.v and do M-x proof-check-proofs

Copy link
Contributor

@Matafou Matafou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Working like a charm. The "XXX" in docstrings should probably fixed, although for most of them the name of the functions/constants are quite self-explanatory.

@hendriktews
Copy link
Collaborator Author

This is only an intermediate state, it needs some cleanup. I intent to add a batch mode feature, where the result are written into a file, maybe in the test anything protocol (TAP). And I also want to do tests and documentation.
Maybe the whole patch should go into pg-user.el, do you have an opinion about this?

@Matafou
Copy link
Contributor

Matafou commented Mar 28, 2024

I think it would the right place (if if the code is sufficiently prover-independent of course).
TAP seems a good idea too.

@hendriktews
Copy link
Collaborator Author

Hi @erikmd and @Matafou ! I consider this mostly finished. I still plan to add a section in the adapting manual and a changelog entry. Do you want to discuss this PR before merging?

@erikmd
Copy link
Member

erikmd commented Apr 5, 2024

Thanks a lot Hendrik!

I did not have the time this week, but I plan to test it on next Tuesday!

Cheers

@hendriktews hendriktews force-pushed the proof-stat branch 2 times, most recently from ca9fb11 to 232f13b Compare April 13, 2024 16:47
@hendriktews
Copy link
Collaborator Author

The last force-push switched to TAP version 13 (instead of 14). I was told 14 has issues and therefore not as wide tool support.

Copy link
Member

@erikmd erikmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear @hendriktews, sorry for replying late! I've just tested the feature.

It is very nice and useful, thanks! in particular as a regular user of PG's omit-proofs feature :)

I wrote some feedback in the review comments below.

Cheers

command generates a list of all opaque proofs in the current
buffer together with the information whether the proof script is
currently valid or invalid. The command can also be run in batch
mode, for instance in a continuous integration environment.
Copy link
Member

@erikmd erikmd Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is a good use case as well indeed. Did you already tried this? I mean, not from an internal PG elisp test, but from an example GHA script stored in this repo or another one, that would call emacs like this?

emacs --batch --load "init.el" --eval "(proof-check-proofs \"...\")"

And maybe I'm mistaken, but to facilitate this, maybe the function proof-check-proofs should query from some way the filename of the file to test? (which could be the current buffer in interactive mode, for example)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No GHA and no other repo but I manually tested it a lot from the shell. Please see the PG manual for the command line. Adding a test invoking proof-check-proofs from a makefile is probably a good idea.

Copy link
Member

@erikmd erikmd Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently we get this error in GHA:

  emacs -batch -l ../../generic/proof-site.el proof_stat.v \
        --eval '(proof-check-proofs nil "proof_stat.gen-out")'
  Coq project file not detected.
  Coq project file not detected.
  Coq project file not detected.
  Starting: coqtop -topfile /github/workspace/ci/simple-tests/proof_stat.v -emacs
  Hit M-x proof-layout-windows to reset layout
  Window #<window 6 on *goals*> too small for splitting

Adding a test invoking proof-check-proofs from a makefile is probably a good idea.

Yes!—and maybe calling this Makefile test from a specific GHA job would make it more visible in the GHA page?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I investigated the error yesterday: 3-pane mode (on by default) is broken if the frame height is too small and certain Emacses set the frame height to 9 inside a docker container.
In the commit I added yesterday, the test you asked for runs as part of the simple tests. Do you have the opinion that this is not enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certain Emacses set the frame height to 9 inside a docker container.

OK!

In the commit I added yesterday, the test you asked for runs as part of the simple tests. Do you have the opinion that this is not enough?

No worries! it is enough as is.

Thanks a lot @hendriktews !

(setq src-file (buffer-name)))

;; generate header
(with-current-buffer (get-buffer-create proof-check-report-buffer)
Copy link
Member

@erikmd erikmd Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback:

  • (important) I believe the *proof-check-report* buffer should be read-only, adding (read-only-mode) somewhere here.
  • (minor, maybe to do later, not in this PR!) It could be nice to just type RET on one of the lemma name, to directly switch to it (handy if the .v file is very large), you know, a bit like the *ert* buffer of M-x ert.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • read-only: good point
  • key binding: good idea, but I am not motivated to do this now. Instead I envision an extension of proof-check-proofs that annotates failing theorems in the Coq sources with (* FAIL *). For my repos I then want to set up a CI action that only checks the consistency of these FAIL comments using proof-check-proofs. This way, fixed proofs and new failing ones pop up prominently during review and one can search form them. Moreover, M-. (xref-find-definitions) works in the report buffer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annotates failing theorems in the Coq sources with (* FAIL *)

OK, looks like a nice idea!

M-. works in the report buffer.

Great!

@erikmd
Copy link
Member

erikmd commented Apr 13, 2024

The last force-push switched to TAP version 13 (instead of 14). I was told 14 has issues and therefore not as wide tool support.

OK looks good, but I'm not TAP-savvy, so I can't comment more on this one.

@hendriktews
Copy link
Collaborator Author

OK looks good, but I'm not TAP-savvy

Neither me, but our local QA expert is.

@hendriktews
Copy link
Collaborator Author

Rebasing this PR on #761 to fix the errors in the previous test run.

The first phase only classifies proofs to be omitted and stuff not to
be omitted. The second phase does the actual replacement and adjusts
the overlays/spans. Feature wise this commit does not change anything
but it enables reusing the first phase for new features.

Additionally, slightly extend the omit proofs test.
M-x proof-check-proofs checks all proofs in one buffer and displays a
list with which tests currently pass or fail. This is a Proof General
implementation of coq/coq#1147. It enables a PVS-like workflow where
files are processed with -vos and proof-omit-proofs-option enabled
such that one can focus on the most interesting/difficult proof
instead of the first failing one.
- read-only and no undo in report buffer
- add a batch mode test for proof-check-proofs; require seq library to
  make this work in Emacs 26
@hendriktews hendriktews merged commit 6cace58 into ProofGeneral:master Apr 25, 2024
119 checks passed
@hendriktews hendriktews deleted the proof-stat branch April 25, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants