Record the checks a module operation skipped - #22374
Open
JasonGross wants to merge 3 commits into
Open
Conversation
Print Assumptions had nothing to report for a definition produced by inlining a body that was accepted with fewer checks, or by a functor application, an Include or a sealing that was itself performed with fewer checks. The constant that knew is gone after inlining, and the operation's own subtyping checks belong to no declaration at all, so the result claimed full checking. Module bodies now carry the flags of the operation that built them. rocqchk weakens its own re-checking by them, the way it already does per constant, so it accepts these files and lists them in its context summary instead of rejecting them; Print Assumptions reports a constant under the flags of the modules it sits in. Fix rocq-prover#12155, fix rocq-prover#16646. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
doc:refman builds sphinx with -W, so the unresolved reference was fatal: doc/unreleased.rst:10: WARNING: rocq:cmd reference target not found: rocqchk [ref.cmd] rocqchk is a program, not a vernacular command. The other two roles in the entry, Print Assumptions and Include, are declared in the refman. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Print Assumptionsreports a definition as closed under the global context when it was built with universe checking off, if a module operation was involved.Four shapes, one cause. The operation either inlines a body someone else checked (
Parameter Inline, above, #12155) or runs its own subtyping check (functor application #16646,Include, sealingModule M : T := X). Neither leaves a trace in a declaration: inlining drops the reference to the constant that recorded the skipped check, and a subtyping check belongs to no declaration at all.Not only universes. The same setup with
Unset Guard Checkingand a non-terminatingFixpointmakesrocq compileaccept androcqchkreject withType error: IllFormedRecBody, because the derived constant claims a guard check nobody ran.Fix
Module bodies get
mod_typing_flags: the checks the operation actually performed, i.e. the flags in force for its subtyping checks, met with the flags of every body it inlined. An ordinary module records full checking.rocqchkweakens its own re-checking by them at the top ofcheck_module. It has to be the module and not the declarations, because the checker redoes the operation:check_mexprre-runscheck_subtypesfor the application,check_modulere-compares the result against the stored signature, and neither is attributable to a declaration.CheckFlags.set_local_flagsbecomes a meet, so an inner declaration cannot ask back for a check the enclosing operation skipped.Print Assumptionsreports a constant under the flags of the modules it sits in, following the user name — for a sealed module it is the sealing that skipped the check, not the implementation.Behaviour change:
rocqchknow accepts these files and lists the constants underConstants/Inductives relying on type-in-type(or... unsafe (co)fixpoints), where before it rejected two of the four.All four
check_*travel,check_eliminationsincluded, though nothing can currently set that one..vogains one field on module bodies.vo_magicis derived from the version number, so there is nothing to bump.Tests
test-suite/output/bug_12155.vfor whatPrint Assumptionssays andtest-suite/output-coqchk/bug_12155.vfor what the checker says, covering the four shapes, the guard case, and one where nothing is recorded. Full test-suite green.Fixes #12155, fixes #16646.
Turned up on the way, unrelated:
rocqchkprintedAnomaly "Uncaught exception Modops.ModuleTypingError(_)"for two of these rather than an error message — #22373.Opened autonomously by Claude (Opus 5) on behalf of Jason Gross (jason@theorem.dev).