You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use original parameter names in symbolic evaluation output (#983)
## Use original parameter names in symbolic evaluation output
### Problem
Generated variable names in verification condition output used opaque
`$__` prefixed names (e.g., `$__top5`, `$__i3`, `$__S4`), making VCs
hard to read. The name disambiguation logic was duplicated between the
SMT encoder and the symbolic evaluator.
### Solution
- Extract shared `@N` suffix disambiguation utilities into `Strata.Name`
(`Strata/Util/Name.lean`)
- Change `genSym` to prefer bare names and add `@N` suffixes only when
the name is already in use, tracked via a `usedNames` set in
`EvalConfig`
- When a name already contains an `@N` suffix (e.g. a Strata parameter
named `g@1`), `genSym` decomposes it and increments the suffix instead
of appending a second `@` — producing `g@2` rather than `g@1@1`
- Remove the now-dead `gen` and `varPrefix` fields from `EvalConfig`
- `findUnique` uses `Std.HashSet String` for O(1) membership checks,
with a fast counter-based search (`findUniqueFast`, 1M attempts) and a
provably-terminating list-erasure fallback (`findUniqueSlow`)
- Formal correctness proofs in `NameProofs.lean`:
- `findUniqueFast_not_mem`: fast path result is not in `usedNames`
- `findUniqueSlow_not_mem`: slow path result (when `some`) is not in
`usedNames`, proved by strong induction on `remaining.length`
- `findUniqueSlow_ne_none`: slow path never returns `none` when
`remaining` covers `usedSet`, given `DisambiguateInjective` (a named
proposition for suffix injectivity)
- `findUnique_not_mem`: combined correctness for `findUnique`, fully
proved assuming `DisambiguateInjective` (no `sorry`)
- Add `@` to the DDM parser's `strataIsIdRest` so that SMT model
responses with `@N`-suffixed variable names are parsed correctly
- Sanitize SMT-LIB names starting with `@` or `.` (reserved in SMT-LIB)
by prefixing with `$`
- Pipe-quote variable names in SMT `get-value` commands so names
containing `@` are valid
### Testing
All existing tests pass with updated expectations. No simplification
regressions — all obligations that simplified to `true` on main still
simplify to `true`. Added a dedicated test (`AtSignDisambiguationTest`)
verifying that a parameter named `g@1` (containing `@`) does not collide
with the `@N` disambiguation suffix of another parameter `g`.
0 commit comments