Repository navigation
fix(clone): theory overrides of nested or overlapping theories - #1207
Merged
Merged
Conversation
Two problems with theory overrides `theory X <- T` in clones.
An override of a nested theory, `theory B.A <- T`, was recorded under
its last component, at the top level: an unrelated theory `A` of the
cloned theory lost its import, and a second override `theory A <- T'`
failed with an assertion failure. Theory overrides are now recorded
under their full path, and a duplicate one is reported as such.
A theory override together with a more specific override, as in:
clone Leaf as L with theory B.A <- Arr, theory B <- B0.
failed with an assertion failure, or reported a duplicate override
when given in the other order. Theory overrides are now processed
after the other overrides, the most specific first, and leave alone
the items that already have an override: the more specific override
wins, whatever the order.
In particular, a theory `B` produced by a clone that overrode its
sub-theory `A` with `theory A <- U` can now be threaded through
further clones with `<-`. That sub-theory was cleared, so that
`theory B <- B` alone fails, as `B.A` has no target; the clones give:
theory B <- B, theory B.A <- U
where `<=` was needed so far, at the cost of a copy of the threaded
theory in every clone.
Also, a clone now replays a theory alias with its substituted target,
instead of the original one.
strub
force-pushed
the
fix/clone-theory-override
branch
from
October 14, 2026 13:02
81f0825 to
5c7b39a
Compare
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.
Two problems with theory overrides
theory X <- Tin clones.An override of a nested theory,
theory B.A <- T, was recorded underits last component, at the top level: an unrelated theory
Aof thecloned theory lost its import, and a second override
theory A <- T'failed with an assertion failure. Theory overrides are now recorded
under their full path, and a duplicate one is reported as such.
A theory override together with a more specific override, as in:
failed with an assertion failure, or reported a duplicate override
when given in the other order. Theory overrides are now processed
after the other overrides, the most specific first, and leave alone
the items that already have an override: the more specific override
wins, whatever the order.
In particular, a theory
Bproduced by a clone that overrode itssub-theory
Awiththeory A <- Ucan now be threaded throughfurther clones with
<-. That sub-theory was cleared, so thattheory B <- Balone fails, asB.Ahas no target; the clones give:where
<=was needed so far, at the cost of a copy of the threadedtheory in every clone.
Also, a clone now replays a theory alias with its substituted target,
instead of the original one.