Skip to content

Fix SMT-LIB conformance of echo and :error-behavior (#415, #416) - #652

Merged
ahmed-irfan merged 1 commit into
masterfrom
fix-smt2-echo-error-behavior
Jul 6, 2026
Merged

Fix SMT-LIB conformance of echo and :error-behavior (#415, #416)#652
ahmed-irfan merged 1 commit into
masterfrom
fix-smt2-echo-error-behavior

Conversation

@ahmed-irfan

@ahmed-irfan ahmed-irfan commented Jul 6, 2026

Copy link
Copy Markdown
Member

Fixes two SMT-LIB 2.6 conformance bugs in the yices_smt2 frontend.

#416echo omitted the surrounding double-quotes

The standard (§4.2.9): "(echo s) … simply prints back s as is—including the surrounding double-quotes." Yices printed only the decoded contents. smt2_echo now reconstructs a valid string literal: it re-adds the surrounding quotes and re-escapes embedded quotes the same way the lexer reads them — doubling ("") in 2.5/2.6 mode, backslash (\", \\) in legacy 2.0 mode (§3.1).

(echo "hello world")   =>  "hello world"    (was: hello world)

#415:error-behavior misreported

get-info :error-behavior returned immediate-exit, but Yices does not exit on command errors — it reports the error and keeps executing. Report the accurate value continued-execution (§4.1.8).

Confirmed against the SMT-LIB 2.6 standard

Verified verbatim against the SMT-LIB 2.6 reference (r2021-05-12):

  • §4.2.9 (echo), p.67: "(echo s) where s is a string literal, simply prints back s as is—including the surrounding double-quotes." → output must include the quotes, so (echo "ok") yields "ok", not ok.
  • §3.1 (Lexicon), p.22: "The character \" can itself occur within a string literal only if duplicated … treat the sequence \"\" as an escape sequence." → the only escape is ""; backslash is not special. This is why embedded quotes are doubled when re-emitting in 2.6 mode.
  • §4.1.8 (Solver information), p.58: ":error-behavior … r is either immediate-exit or continued-execution. … continued-execution indicates that when an error is encountered, the solver will return to the state it was in immediately before the command triggering the error, and continue accepting and executing new commands." → matches Yices's actual behavior.

Tests

  • New regression tests iss415 and iss416 (the latter covers plain quoting, legacy \" escaping, and 2.6 "" doubling).
  • Updated the gold files of existing echo tests (test_qfaufbvlia, test_qfufbvlia, test_qfbvlra, mcsat/test_qfaufbvnia) to the now-quoted output. These gold files recorded the pre-fix (non-conformant) unquoted output; §4.2.9 mandates the quoted form.

Follow-up

  • "" escape sequence not supported in strings #417"" string escape not supported by default. Per §3.1 the "" escape is the only way to embed a quote in a 2.6 string literal, but Yices only accepts it when (set-info :smt-lib-version 2.5|2.6) is set (it flips the lexer's two_dot_five_variant); by default it still uses the legacy 2.0 \" / \\ escapes. Resolving "" escape sequence not supported in strings #417 means either making the 2.6 "" variant the default or adding a CLI flag to select it. Left out of this PR because it changes default lexer behavior and warrants a separate decision. This PR's smt2_echo already re-escapes correctly under both variants, so it composes cleanly with whichever direction "" escape sequence not supported in strings #417 takes.

- echo now prints the string literal back with its surrounding double
  quotes, re-escaping embedded quotes to match how the lexer reads
  strings in the active SMT-LIB version (#416).
- report :error-behavior as continued-execution, which is what Yices
  actually does: it reports an error and keeps executing commands
  rather than exiting (#415).
- add regression tests iss415/iss416 and update the gold files of
  existing echo tests to the now-quoted output.
@ahmed-irfan
ahmed-irfan merged commit d7a1fdf into master Jul 6, 2026
32 checks passed
@ahmed-irfan
ahmed-irfan deleted the fix-smt2-echo-error-behavior branch July 6, 2026 21:00
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.

Double quotes omitted in echo command response Doesn't always exit immediately on error

1 participant