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
Escape SMT-LIB set-info strings per SMT-LIB 2.6+ (doubled quotes) (#1112)
`Verifier.encodeCore` was rendering `(set-info :final-message "...")`
with C-style escaping (backslash + quote) for embedded double quotes and
backslashes in the property summary. That is invalid in SMT-LIB 2.6+:
the backslash has no special meaning inside a string literal (except
`\u{XXXX}` for Unicode escapes), so for input
Expected len(kwargs["JobName"]) >= 1, got stringLen(kwargs[JobName])
the encoder emitted
(set-info :final-message "Expected len(kwargs[\"JobName\"]) >= 1, got
stringLen(kwargs[JobName])")
which an SMT-LIB parser reads as a string that ends after the first `\"`
(a literal backslash followed by a string-closing quote), with the rest
(`JobName\"...`) sitting outside any command and triggering a parse
error. Per the spec (§3.1.2), a literal double quote inside an SMT-LIB
string must be written as two consecutive double quotes.
An `escapeSMTStringLit` helper that already does this (and also handles
non-printable characters via `\u{XXXX}`) existed in
`Strata/DDM/Util/String.lean` and is already used by the user-error path
in `StrataMain.lean`. Wire it into the `Solver` API as a typed
`setInfoString` wrapper and use it everywhere a string-valued `set-info`
attribute is emitted:
- `Verifier.lean`: the `:final-message` site (the site the reported
failure hit) plus the `:sat-message` / `:unsat-message` sites in
`addLocationInfo`. The `sat-message` / `unsat-message` callers
previously pre-quoted their argument; they now pass the raw Lean string.
- `SMTUtils.lean`: the `:file` site and the forwarded application-
supplied `(name, value)` message. The latter's contract changes from
"pre-quoted value" to "raw Lean string" accordingly.
The plain `setInfo` remains available for attribute values that are
already valid SMT-LIB tokens (integers, s-expressions), and is still
used for `:start` / `:stop`.
Regression tests in `SMTEncoderTests.lean` cover both the reported case
(embedded double quotes escaping to `""`) and the complementary case
(embedded backslash staying literal, no escape). Each fails on
origin/main and passes here.
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
---------
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
0 commit comments