Skip to content

Attribute #[clearbody] useful instead of Let ... Qed - #17544

Merged
coqbot-app[bot] merged 1 commit into
rocq-prover:masterfrom
SkySkimmer:clearbody-att
May 24, 2023
Merged

Attribute #[clearbody] useful instead of Let ... Qed#17544
coqbot-app[bot] merged 1 commit into
rocq-prover:masterfrom
SkySkimmer:clearbody-att

Conversation

@SkySkimmer

Copy link
Copy Markdown
Contributor

cf discussion in #17205

@SkySkimmer
SkySkimmer requested review from a team as code owners April 27, 2023 13:05
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Apr 27, 2023
Comment thread doc/sphinx/language/core/sections.rst Outdated
Comment thread doc/sphinx/language/core/sections.rst Outdated
Comment thread vernac/declare.ml Outdated
?hook ?typing_flags () =
{ poly; inline; kind; udecl; scope; hook; typing_flags }
let () = match scope, clearbody with
| Discharge, true ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we just put clearbody in the Discharge constructor? IMHO that's better it doesn't make sense for Global.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could put it in the Discharge, although that type is also used for variables (ie no body) so I wasn't sure it would make much sense.
OTOH passing clearbody alongside it isn't better for that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah maybe it has to go in the SectionLocalDef constructor? Would be good if we can find a way to avoid the assert etc... in the end the clearbody flag is used in a very very specific place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I put it in SectionLocalDef, although it's still also in Info.t as SectionLocalDef is created late.
I moved this check to the attribute handling (synterp.ml defattributes)

Comment thread vernac/declare.ml Outdated
Comment thread vernac/declare.ml Outdated

@ejgallego ejgallego left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems to me that the clearbody flag should be attached to maybe the SectionLocalDef constructor as it is the only place where it makes sense.

@SkySkimmer SkySkimmer added the needs: progress Work in progress: awaiting action from the author. label Apr 27, 2023
Comment thread doc/sphinx/language/core/sections.rst Outdated
@SkySkimmer SkySkimmer added request: full CI Use this label when you want your next push to trigger a full CI. and removed needs: progress Work in progress: awaiting action from the author. labels Apr 28, 2023
@coqbot-app coqbot-app Bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Apr 28, 2023
@proux01

proux01 commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Nice, but in mathcomp we would still prefer having Let lema. Proof. <proof> Qed act as Let lemma. Proof. abstract(<proof>). Defined. (if that is not overly broken) rather than having to put verbose #[clearbody] ... Defined everywhere.

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

That seems not broken, but the change of behaviour definitely would need a deprecation phase.

@proux01

proux01 commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Do you have it anywhere so that I could try it on mathcomp?

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

If you mean having abstract I haven't coded it.
It's equivalent to translating Let foo : T. proof. Qed. into Lemma foo_subproof : T. proof. Qed. Let foo := foo_subproof. so there shouldn't be major issues.

@proux01

proux01 commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Ok, I'll give it a try. For the deprecation phase, we could have an attribute #[abstract] for Let that will be deprecated right away and the current warning message for Let Qed offering to try it. Then, after deprecation phase, #[abstract] will become the default and be removed a few versions later.

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

We could also do an option eg Let Qed Is Abstract and deprecate unsetting it.

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

#17553

@github-actions github-actions Bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label May 1, 2023
@coqbot-app coqbot-app Bot added needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. and removed needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. labels May 2, 2023
@SkySkimmer
SkySkimmer requested a review from a team May 3, 2023 13:43

@ejgallego ejgallego left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Declare parts look Ok, would be nice to do some more cleanup in another PR w.r.t. section handling etc...

@SkySkimmer

Copy link
Copy Markdown
Contributor Author

I tried something like that too but Discharge is also used for Variable and I liked having clearbody in those paths less

@jfehrle jfehrle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some suggestions and questions

Comment thread doc/changelog/08-vernac-commands-and-options/17544-clearbody-att.rst Outdated
Comment thread doc/changelog/08-vernac-commands-and-options/17544-clearbody-att.rst Outdated
Comment thread doc/sphinx/language/core/sections.rst
@ejgallego

Copy link
Copy Markdown
Contributor

I tried something like that too but Discharge is also used for Variable and I liked having clearbody in those paths less

Yes, it seems to me the current setup is a good compromise. How to improve it I have no idea, it could require having some more static typing for sections (as we do for interactive proofs now)

@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 5, 2023
@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label May 5, 2023
@coqbot-app coqbot-app Bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels May 5, 2023
@SkySkimmer

Copy link
Copy Markdown
Contributor Author

updated doc

SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request May 5, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
@SkySkimmer

Copy link
Copy Markdown
Contributor Author

#17576 to experiment with Qed behaving like abstract

@ejgallego

Copy link
Copy Markdown
Contributor

@SkySkimmer should we merge this? @silene are you OK with this?

SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request May 10, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request May 12, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label May 15, 2023
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label May 15, 2023
@SkySkimmer

Copy link
Copy Markdown
Contributor Author

This is ready IMO

@ejgallego

ejgallego commented May 22, 2023

Copy link
Copy Markdown
Contributor

Will leave one day in case anyone wants to comment.

In light of #17576 I still think that maybe a better path forward could be to actually have a #[proof_env] attribute that would instead add stuff to the named environment , I get the feeling that this could make the code more orthogonal, so Let would become implemented as other things that run a hook after a declaration.

That could also be combined with some sort of "inline" attribute for section defs.

@ejgallego

Copy link
Copy Markdown
Contributor

@coqbot: merge now

@coqbot-app
coqbot-app Bot merged commit cabc945 into rocq-prover:master May 24, 2023
@SkySkimmer
SkySkimmer deleted the clearbody-att branch May 24, 2023 12:54
proux01 pushed a commit to SkySkimmer/rocq that referenced this pull request Sep 22, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
proux01 pushed a commit to SkySkimmer/rocq that referenced this pull request Sep 25, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request Nov 2, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request Nov 2, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request Nov 2, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
SkySkimmer added a commit to SkySkimmer/rocq that referenced this pull request Nov 2, 2023
cf discussion in rocq-prover#17544

This does have a tradeoff as the side definition still exists after
the section is closed unlike usual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: cleanup Code removal, deprecation, refactorings, etc. kind: compatibility Changes allowing for compatibility between versions. kind: design discussion Discussion about the design of a feature. kind: redesign The same functionality is being re-implemented in a different way. kind: usability Not a bug (fix) but a usability issue / improvement, e.g. UI or syntax inconsistencies part: attributes #[attributes] modify the behaviour of vernac sentences. part: sections The section mechanism of Coq. part: vernac High level command interpretation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants