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

omit-proofs: handle commands that may have global effects #694

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

hendriktews
Copy link
Collaborator

Add the predicate `proof-script-cmd-prevents-proof-omission' to the omit-proofs framework, whose purpose is to check whether commands inside proofs might have global effects such that the proof must not be omitted.

Fixes #688

Comment on lines +755 to +759
(if (proof-string-match coq-lowercase-command-regexp cmd)
nil
(not (coq-state-preserving-p cmd))))
Copy link
Member

@erikmd erikmd Mar 20, 2023

Choose a reason for hiding this comment

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

as suggested in issue #689 (comment)

I guess the lowercase test is unneeded; why not using something like this?

Suggested change
(if (proof-string-match coq-lowercase-command-regexp cmd)
nil
(not (coq-state-preserving-p cmd))))
(or (proof-string-match coq-keywords-state-changing-commands cmd)
; (not (proof-string-match coq-keywords-local-state-changing-commands cmd)) ; TODO
))

For the TODO line, I'd rely on @hendriktews's suggestion to add another STATECH value and extend this:

PG/coq/coq-syntax.el

Lines 1158 to 1168 in 8416875

(defvar coq-keywords-state-changing-commands
(append
coq-keywords-state-changing-misc-commands
coq-keywords-decl ; all state changing
coq-keywords-defn ; idem
coq-keywords-goal)) ; idem
;;
(defvar coq-keywords-state-preserving-commands
(coq-build-regexp-list-from-db coq-commands-db 'filter-state-preserving))

@erikmd
Copy link
Member

erikmd commented Jan 16, 2024

Sorry I believe some improvement of you for the omit-proof feature (maybe this PR, I didn't re-checked) was stalled because of belated review from Pierre and I; sorry for that.

So @hendriktews, do you think you'd need further test or discussion from us for this PR?

Anyway I'd like to propose we pause our recurring PG maint telco this month (too many deadlines for me about grading or so in the upcoming two weeks), and resume in Feb…

Kind regards

@hendriktews
Copy link
Collaborator Author

There has been no progress on the preferred solutions that we discussed last year. Therefore I propose merging this PR as is (assuming all tests pass). Erik, note that your suggestion does not work as proposed, because coq-keywords-state-changing-commands is a list. As long as the proposed coq-keywords-local-state-changing-commands does not exist, it has the same problem with Focus, namely not omitting proofs that contain Focus.

@hendriktews hendriktews marked this pull request as ready for review January 16, 2024 23:43
@hendriktews
Copy link
Collaborator Author

Hi @erikmd , no problem! I am pretty confident about this PR and about #696 in the sense that they are not perfect, but good enough. So I don't need anything. I just want to give you the chance to comment, but if you are busy, I'll merge in a week or so. I commit to improve this fix when someone is motivated to add the coq-keywords-local-state-changing-commands that we discussed.

Add the predicate `proof-script-cmd-prevents-proof-omission' to the
omit-proofs framework, whose purpose is to check whether commands
inside proofs might have global effects such that the proof must not
be omitted.

Fixes ProofGeneral#688
@hendriktews hendriktews merged commit 85a35ad into ProofGeneral:master Jan 22, 2024
131 checks passed
@hendriktews hendriktews deleted the omit-hint-fix branch January 22, 2024 16:13
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.

"Omit proofs" breaks other proofs because it also skips hints
2 participants