fix: wary substitution + concrete subst parsing + de Bruijn shadowing - #19
Merged
Conversation
…Bruijn)
Port the substitution work from the Solidity extension to Rust:
- WarySubstOp / WaryClashFreeSubst: a non-rigid replacement (e.g. a program
variable) is no longer pushed across a modality, behind an update, or into
a transformer; such occurrences are kept and the substitution is left as a
residual (subst_to_eq can then Skolemize). Rigid replacements push as
before. WarySubstOp.SUBST replaces SubstOp.SUBST in the parser/notation.
- visitSubstitution_term: no longer throws "TODO @ DD" — a concrete
{\subst T x; t} phi declares its own de Bruijn bound variable and unbinds
afterwards.
- lookupVarfuncId: search bound variables innermost-first, so a shadowed
name binds to the innermost binder (\forall x; \forall x; p(x) — index 1).
WarySubstAndShadowingTest covers all three.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 17, 2026
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.
What
Wary substitution + concrete subst parsing + a de Bruijn shadowing fix.
WaryClashFreeSubst/WarySubstOp: correct substitution under binders soshadowed variables are not captured (de Bruijn handling).
ExpressionBuilder: parse concrete substitutions.NotationInfo: pretty-print support.WarySubstAndShadowingTest.Foundational fix that the argument-sorts, casts and GUI PRs build on, so it is
sent first as its own PR (stacked underneath them).
Base:
rusty-dev.