Correctly detect body for module-type-locked constants#173
Open
JasonGross wants to merge 3 commits into
Open
Conversation
e3f8281 to
5051e0a
Compare
Collaborator
|
I am opposed to considering Anthropic's Claude as a co-author of this code, because this is not a person. You, @JasonGross, are the author, and any risk associated with this code is your responsibility. Whether you are using an advanced tool to suggest code that works is your problem, but in the end you have to check that you are using existing OCaml functionalities and examples from the code base in an appropriate manner. |
Member
Author
|
Let me mark this as a draft until I am satisfied with it |
413d078 to
4e5f748
Compare
JasonGross
added a commit
that referenced
this pull request
Feb 7, 2026
2704633 to
64c5552
Compare
Member
Author
|
I am now satisfied with this. Most of the code is taken verbatim from Rocq's source (and should be kept in sync with any updates that are made there, presumably). |
When a module is constrained by a module type using `:`, the constant bodies appear as Undef in the global environment but still exist in the module structure. This caused dpdgraph to incorrectly report body=no for such constants. Following the approach used by Print Assumptions in vernac/assumptions.ml, implement a ModLookup module that traverses the module structure to find the actual constant body when the environment lookup returns Undef. This ensures that module-type-locked constants like: Module Foo : FooT. Definition T := O. End Foo. correctly report body=yes instead of body=no. We need to add fallback behaviors for doing anything with names that might not be in the nametab. Add test cases to verify the behavior.
64c5552 to
40cec6d
Compare
JasonGross
added a commit
to JasonGross/coq-dpdgraph
that referenced
this pull request
Mar 22, 2026
ebmoon
pushed a commit
to theorem-labs/coq-dpdgraph
that referenced
this pull request
Apr 15, 2026
Member
Author
|
CI now passes, what do you think @ybertot ? |
Member
Author
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.
When a module is constrained by a module type using
:, the constant bodies appear as Undef in the global environment but still exist in the module structure. This caused dpdgraph to incorrectly report body=no for such constants.Following the approach used by Print Assumptions in vernac/assumptions.ml, implement a ModLookup module that traverses the module structure to find the actual constant body when the environment lookup returns Undef.
This ensures that module-type-locked constants like:
Module Foo : FooT. Definition T := O. End Foo.
correctly report body=yes instead of body=no.
Add test case ModuleTypeLocked.v to verify the behavior.
Fixes #172