Correctly implement δ-resolver lift for modules. - #22451
Merged
coqbot-app[bot] merged 1 commit intoSep 9, 2026
Merged
Conversation
Module δ-resolvers are morally a kind of substitution, associating
a canonical name to some aliased constant. Functors and module types
are function-like w.r.t. to resolvers, insofar as the name they introduce
is bound and should be left alone. This is similar to the λ-calculus
equation (λt){σ} ≡ λ(t{σ↑}) where substitutions must be lifted when going
under a context.
Unfortunately, the resolver mechanism is not based on De Bruijn indices
but names, and the implementation was implementing the lift in a broken
way, by adding the trivial equivalence p ↦ p for some bound path p.
As is expected, this does not play well with the usual algebraic
operations one expect to apply to resolvers, leading to interesting
breakage of invariants here and there. It did not seem enough to prove
False though, just random anomalies and incompletenesses.
We fix this mess by introducing an explicit lift operation in δ-resolvers
which is handled specifically by substitution. En passant, the internals
of Mod_subst are horrendous as they rely on physical equality (!) for some
reason, resulting in interesting eisenbugs while trying to change the
implementation.
Fixes rocq-prover#22426: Self-equivalence within δ-resolvers not stable by aliasing.
Member
Author
|
Note that the example added after the fact in #22426 is not solved by this patch, so I'll put it in a different issue. |
SkySkimmer
approved these changes
Sep 9, 2026
Contributor
|
@coqbot merge now |
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.
Module δ-resolvers are morally a kind of substitution, associating a canonical name to some aliased constant. Functors and module types are function-like w.r.t. to resolvers, insofar as the name they introduce is bound and should be left alone. This is similar to the λ-calculus equation (λt){σ} ≡ λ(t{σ↑}) where substitutions must be lifted when going under a context.
Unfortunately, the resolver mechanism is not based on De Bruijn indices but names, and the implementation was implementing the lift in a broken way, by adding the trivial equivalence p ↦ p for some bound path p. As is expected, this does not play well with the usual algebraic operations one expect to apply to resolvers, leading to interesting breakage of invariants here and there. It did not seem enough to prove False though, just random anomalies and incompletenesses.
We fix this mess by introducing an explicit lift operation in δ-resolvers which is handled specifically by substitution. En passant, the internals of Mod_subst are horrendous as they rely on physical equality (!) for some reason, resulting in interesting eisenbugs while trying to change the implementation.
Fixes #22426: Self-equivalence within δ-resolvers not stable by aliasing.