Attribute #[clearbody] useful instead of Let ... Qed - #17544
Conversation
| ?hook ?typing_flags () = | ||
| { poly; inline; kind; udecl; scope; hook; typing_flags } | ||
| let () = match scope, clearbody with | ||
| | Discharge, true -> |
There was a problem hiding this comment.
Can't we just put clearbody in the Discharge constructor? IMHO that's better it doesn't make sense for Global.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
ejgallego
left a comment
There was a problem hiding this comment.
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.
7ef9be9 to
30560b4
Compare
30560b4 to
d3295eb
Compare
|
Nice, but in mathcomp we would still prefer having |
|
That seems not broken, but the change of behaviour definitely would need a deprecation phase. |
|
Do you have it anywhere so that I could try it on mathcomp? |
|
If you mean having |
|
Ok, I'll give it a try. For the deprecation phase, we could have an attribute |
|
We could also do an option eg |
ejgallego
left a comment
There was a problem hiding this comment.
Declare parts look Ok, would be nice to do some more cleanup in another PR w.r.t. section handling etc...
|
I tried something like that too but Discharge is also used for Variable and I liked having |
jfehrle
left a comment
There was a problem hiding this comment.
Some suggestions and questions
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) |
|
updated doc |
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
|
#17576 to experiment with Qed behaving like abstract |
|
@SkySkimmer should we merge this? @silene are you OK with this? |
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
|
This is ready IMO |
|
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 That could also be combined with some sort of "inline" attribute for section defs. |
|
@coqbot: merge now |
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in rocq-prover#17544 This does have a tradeoff as the side definition still exists after the section is closed unlike usual.
cf discussion in #17205