Skip to content

fix: wary substitution + concrete subst parsing + de Bruijn shadowing - #19

Merged
Drodt merged 1 commit into
rusty-devfrom
rusty-debruijn
Jun 17, 2026
Merged

fix: wary substitution + concrete subst parsing + de Bruijn shadowing#19
Drodt merged 1 commit into
rusty-devfrom
rusty-debruijn

Conversation

@unp1

@unp1 unp1 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

What

Wary substitution + concrete subst parsing + a de Bruijn shadowing fix.

  • WaryClashFreeSubst / WarySubstOp: correct substitution under binders so
    shadowed variables are not captured (de Bruijn handling).
  • ExpressionBuilder: parse concrete substitutions.
  • NotationInfo: pretty-print support.
  • Adds 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.

…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>
@Drodt
Drodt merged commit 36136c1 into rusty-dev Jun 17, 2026
1 of 3 checks passed
@Drodt
Drodt deleted the rusty-debruijn branch June 17, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants