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

Prooftree updates #439

Merged
merged 11 commits into from
Feb 23, 2024
Merged

Conversation

hendriktews
Copy link
Collaborator

This PR contains the work in progress for updating proof tree display support in PG. It should work with the upstream head of prooftree and Coq PR 10489. I strongly suggest to not merge this until after this Coq PR has been merged.

@erikmd
Copy link
Member

erikmd commented Jun 23, 2020

Hi @hendriktews, what the status of this PR?

@erikmd
Copy link
Member

erikmd commented Jun 23, 2020

@hendriktews
Copy link
Collaborator Author

hendriktews commented Jun 24, 2020 via email

@erikmd
Copy link
Member

erikmd commented Jun 25, 2020

Thanks a lot @hendriktews for your detailed reply.

I suggest to only support proof tree display for Coq >= 8.11 in the future.

OK for me!

If there is interest in trying proof tree visualization with Coq 8.11 with a few known bugs, then let me know and I will make something available.

Thanks @hendriktews! but at first sight there is no hurry, unless some users request it soon…

Otherwise I would slowly continue with the remaining bugs and also add documentation, before proposing to merge this PR.

LGTM. − And at that time, you may also want to further document/advertise the feature? (e.g. by mentioning the proof-tree feature and installation instructions in https://proofgeneral.github.io/ and in Coq's discourse :)

@hendriktews hendriktews changed the title Prooftree updates - don't merge! Prooftree updates Feb 18, 2021
@hendriktews
Copy link
Collaborator Author

Finally I solved the crashes and the other critical problems. Some minor problems are still present, but I believe they can be postponed until after merging this PR.
This PR is in sync with the current version of Prooftree (hendriktews/proof-tree@7b18f01).

@Matafou
Copy link
Contributor

Matafou commented Oct 15, 2021

@hendriktews this seems to ne easy to rebase. Is there any reason not to?

@hendriktews hendriktews force-pushed the prooftree-updates branch 2 times, most recently from 479d319 to c1c2711 Compare January 7, 2024 21:56
@hendriktews
Copy link
Collaborator Author

Hi @erikmd and @Matafou, IMO this PR is now ready for review. What remains is maybe some polishing of the prooftree repo and then a release there. Some of the commits are quite big, so I am not sure how the review could be done. Maybe you just try it out?

@hendriktews hendriktews requested review from erikmd and Matafou January 7, 2024 22:49
@Matafou
Copy link
Contributor

Matafou commented Jan 8, 2024

Hi Hendrik. Seems to work like charm here (ocaml 4.14.1, coq 8.15.1).

One remark on compiling prooftree: configure.sh displays an error:

test ocamlopt.opt -I +lablgtk2
File "_none_", line 1:
Error: Cannot find file lablgtk.cmxa
test ocamlopt.opt -I /home/courtieu/.opam/coq-8.15/lib/lablgtk2

although I had the opam package lablgtk installed and the file /home/courtieu/.opam/coq-8.15/lib/lablgtk2/lablgtk2.cmxa does exist. And indeed doing make afterward succeeded. I am not sure why this happens but this is confusing.

@hendriktews
Copy link
Collaborator Author

Thanks for testing.

One remark on compiling prooftree: configure.sh displays an error:

I agree it is confusing, but it also printed Configuration successful at the end, didn't it?

This happens because I still support compilation without findlib, as it might happen, eg. on bullseye. There one needs -I +lablgtk2, but in your case on opam one would need -I +lablgtk2/lablgtk2. My configure script does a little bit trial-and-error, therefore you might see an error of the first failing trial.

I see if I can add some more messages.

@Matafou
Copy link
Contributor

Matafou commented Jan 9, 2024

One remark on compiling prooftree: configure.sh displays an error:
I agree it is confusing, but it also printed Configuration successful at the end, didn't it?

Yes.

This happens because I still support compilation without findlib, as it might happen, eg. on bullseye. There one needs -I +lablgtk2, but in your case on opam one would need -I +lablgtk2/lablgtk2. My configure script does a little bit trial-and-error, therefore you might see an error of the first failing trial.

I see if I can add some more messages.

No big deal.

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.

I didn't read all the code, but it LGTM from the user point of view.

This is a major change, because the new Show Goal command in Coq
8.10 can print goals for previous states and therefore permits to
remove all the code that was tracking goals and existential from
PG and to rely on prooftree to request goals and goal updates.

This change does break compatibility for the proof tree display
for Coq 8.6 and before. (The old Coq versions themselves work,
it's just that proof tree display won't work.)

In paricular:
- delete urgent proof tree actions, the hooks and all the
  corresponding code
- delete sequent hash and existentials info and all the corresponding code
- adopt prooftree regular expressions and show goal functions to
  Coq 8.10 (implemented in coq/coq#10489)
- new hooks proof-tree-start-display-hook and
  proof-tree-stop-display-hook for switching Coq's dependent evar
  line on and off
- forward the new show goal commands from prooftree to Coq
- proof tree display starts with the Lemma command, because Proof
  does not display anything anymore
- deleted superfluous proof tree code in hol-light and
  deconfigured prooftree for Hol-Light, IIRC, it was never
  working. But I am happy to provide support, if anybody wants to
  pick this up.
- send evar info for update sequent commands
- update to protocol version 4
- fix starting prooftree inside a proof
The dependent evar line is now unconditionally switched on and
off for proof tree displays. This is controlled by the new option
`coq-proof-tree-manage-dependent-evar-line'.
Show goal does not increase the state number in Coq and should
not be recognized as an undo command in proof-tree.el.
This commit solves the following problem: At the end of a proof
with proof-tree display, a number of show goal requests from
prooftree must possibly be processed, before prooftree sends the
confirm-proof-complete message to signal that Proof General can
continue. For Coq these show goal commands must be sent to Coq
before the dependent evar line is switched off and the result
must be processed by Proof General, therefore before
`proof-tree-external-display' is switched off. Proof General must
therefore stop processing the queue region after the command that
finished the proof until all show goals are processed, the
dependend evar line is off and `proof-tree-external-display' is
nil again. This is achieved by only keeping the priority actions
on proof-action-list and moving whatever remains to
proof-tree--delayed-actions and setting
proof-second-action-list-active. This way only priority actions
(read show goal commands) are processed until prooftree signals
completion and the stuff on proof-tree--delayed-actions is moved
back. To implement this, I introduced (again) an urgent
action (proof-tree-check-proof-finish), which checks for the end
of the proof or the arrival of the last priority action connected
with the current proof-tree display (tagged 'proof-tree-last-item
and queued by the call back proof-tree-confirm-proof-complete).
Delete functions from PG-adapting that have been deleted in the
sources to fix make magic. Delete also some of the outdated
information of the Prooftree configuration section. Note that
this section is still outdated, which is hopefully OK, given the
number of attempts to add Prooftree support for more proof
assistants in the last years.
This commit addresses all the points that have only been marked in the
previous prooftree related commits.
Support Unshelve after all goals have been closed, which shall create
a new layer with all the unshelved goals. Prooftree contains enough
state to determine whether or not a new layer must be created.
Therefore erase the regular expression to recognize commands that are
expected to create a new layer. Also erase the new-layer flag from the
current-goals display command.

NOTE: This commit changes the Prooftree communication protocol. Use
only with Prooftree containing a patch with the same header.
proof-second-action-list-active cannot be used by two packages (i.e.,
proof-tree and coq-par-compile) simultaneously. Therefore assert it is
off when starting a proof-tree display. Also re-initialize
proof-tree--delayed-actions, although it should always be reset at the
end of a proof-tree display, if everything works as expected.
@Matafou
Copy link
Contributor

Matafou commented Feb 19, 2024

@hendriktews do we merge this?

@hendriktews
Copy link
Collaborator Author

@hendriktews do we merge this?

I would be in favor of merging sooner than later.

@hendriktews
Copy link
Collaborator Author

I just released Prooftree 0.14. Merging this now.

@hendriktews hendriktews merged commit 1f07248 into ProofGeneral:master Feb 23, 2024
119 checks passed
@hendriktews hendriktews deleted the prooftree-updates branch April 13, 2024 14:21
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