Class Solver_z3_recent
- All Implemented Interfaces:
ISolver
- Direct Known Subclasses:
Solver_z3_4_5
AbstractSolver -- only the startup command line and
start()/AbstractSolver.exit() (process lifecycle) are overridden. Empirically, none of
the z3-4.3-era workarounds the old version-specific adapters needed (see the git history of
the now-removed Solver_z3_4_5/4_6/4_7/4_8 classes) are needed any more:
bitvector literals print in standard #b/#x form (no bv5[8]-style regex conversion needed),
and errors come back as clean, well-formed (error "...") s-expressions that
AbstractSolver's generic parseResponse handles without any massaging.
:print-success needs an explicit priming command on Linux specifically, same
idea as Solver_z3_4_3: jSMTLIB's own protocol expects a response to every
command it sends, and print-success false (the SMT-LIB-compliant default) means most
commands legitimately produce none on their own. Confirmed via gdb-attaching to a hung
z3 process on Linux CI that the very first real command produced no response at all --
z3 sitting in its own SMT2 scanner blocked reading stdin for more input, having
silently consumed the command and moved on without acking it, which jSMTLIB has no way
to distinguish from a solver that's simply slow, so it just waited forever. macOS/
Windows don't hit this and already have goldens reflecting an un-primed first response,
so the priming command below is Linux-only rather than unconditional -- doing it
everywhere would shift every line-numbered error message on every platform by one, not
just the platform that actually needs it.
One confirmed compliance gap, not caused by this adapter: z3 defaults
:produce-models to true rather than the spec's false, with no
known CLI flag or startup option to change that -- scripts checking that default need a
z3-specific golden reflecting it.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.smtlib.AbstractSolver
AbstractSolver.Pending, AbstractSolver.Shape, AbstractSolver.StackChangeNested classes/interfaces inherited from interface org.smtlib.ISolver
ISolver.CreationException -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]The command-line arguments for launching the solver.protected String[]protected String[]protected String[]protected final booleanTrue only on the platform where the print-success priming command below is needed (see the class javadoc)Fields inherited from class org.smtlib.AbstractSolver
checkSatStatus, END_WAIT_MILLIS, endedByTimeLimit, isMac, isWindows, linesOffset, options, printSuccess, printSuccessResponse, smtConfig, SOLVER_EXITED, solverProcess -
Constructor Summary
ConstructorsConstructorDescriptionSolver_z3_recent(SMT.Configuration smtConfig, String executable) Creates an instance of the solverSolver_z3_recent(SMT.Configuration smtConfig, String[] command) Launches the given command as is (a .command property, #147), without adding the flags the executable form adds -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<AbstractSolver.StackChange> The kinds of command after which this z3 still answers the get- commands about the last check (probed 2026-10-29: z3 4.6 to 5.1 after every declare and define; 4.8 and later also after reset-assertions, which 4.6 and 4.7 report themselves).Checks whether the current assertion set is satisfiable under the current logic.check_sat_assuming(IExpr... exprs) Checks satisfiability under the current assertion set plus the given propositional assumptions.z3 answers get-assignment with :produce-assignments off, and in assert mode after a checkget_info(IExpr.IKeyword key) z3 reports a query stopped by its per-query time limit, -t:, with :reason-unknown "canceled" in incremental mode (after a push; checked with z3 4.16.0 and 5.1.0, while 4.8.12 and 4.12.6 give up first, as incomplete), and in every mode in 4.6 and 4.7; one-shot queries in newer versions, and other solvers such as cvc5, report "timeout".z3 answers get-model in assert mode after a checkz3 answers get-proof in assert mode after a checkz3 answers get-unsat-assumptions in assert mode after a checkz3 answers get-unsat-core in assert mode after a checkz3 answers get-value in assert mode after a checkprotected booleanisTimeLimitResponse(String rawResponse) z3 answers 'timeout' (instead of a result) when its whole-run limit, -T:, ends it, and then exits (checked with z3 4.16.0 and 5.1.0)Patterns matching the line numbers in this solver's messages about the command answered: group 1 is the text before the number, group 2 the number, group 3 the text after itreset()Resets the solver to the initial state, clearing all assertions, declarations, and options.start()Starts the solver; this is not an SMT-LIB command, but it is convenient in some implementations to separate the starting and initialization from the construction of the solver instance.unsatAssumptionsElements(List<IExpr> reply) Drops the labels z3 adds to the unsat assumptions (see Assumptions)unsatCoreElements(List<IExpr> reply) Drops the assumptions z3 adds to the unsat core (see Assumptions)Methods inherited from class org.smtlib.AbstractSolver
assertExpr, checkImmediateExit, checkPrintSuccess, checkSatStatus, checkShape, checkStatus, comment, correctResponse, declare_const, declare_datatype, declare_datatypes, declare_fun, declare_sort, declare_sort_parameter, define_const, define_fun, define_fun_rec, define_funs_rec, define_sort, earlierSourceLine, echo, errorStopsSolver, execute, executePipelined, exit, exitedResponse, finishPipelined, forceExit, get_assertions, get_option, hasPending, inSatMode, interrupt, inUnsatMode, isFlatResponse, logSolverDiagnostics, modelResponse, nextSolverLine, normalizeForTesting, outOfStep, parseResponse, pipelines, pop, proofResponse, push, readPipelined, recordChange, reportsEarlierLines, reportSeedIgnored, requireNoChangeSinceCheck, requireOptionEnabled, requireSatOrUnknown, requireUnsat, reset_assertions, responseEnd, selfReportsImmediateExit, sendChange, sendCommand, sendExitCommand, sendFailure, sendFailure, sendPipelined, sendScriptText, sendSeed, set_info, set_logic, set_option, set_option_impl, setSourceLine, shapeOf, smt, solverName, solverPrintsSuccess, successOrEmpty, timeLimitResponse, timeLimitResponseAfterExit, translate, withSourceLinesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.smtlib.ISolver
assertExpr, checkSatStatus, comment, declare_const, declare_datatype, declare_datatypes, declare_fun, declare_sort, declare_sort_parameter, define_const, define_fun, define_fun_rec, define_funs_rec, define_sort, echo, execute, exit, forceExit, get_assertions, get_option, pop, push, reset_assertions, set_info, set_logic, set_option, setSourceLine, smt, solverName
-
Field Details
-
cmds
The command-line arguments for launching the solver. -
cmds_win
-
cmds_mac
-
cmds_unix
-
needsPrintSuccessPriming
protected final boolean needsPrintSuccessPrimingTrue only on the platform where the print-success priming command below is needed (see the class javadoc)
-
-
Constructor Details
-
Solver_z3_recent
Creates an instance of the solver -
Solver_z3_recent
Launches the given command as is (a .command property, #147), without adding the flags the executable form adds
-
-
Method Details
-
lineNumberPatterns
Description copied from class:AbstractSolverPatterns matching the line numbers in this solver's messages about the command answered: group 1 is the text before the number, group 2 the number, group 3 the text after it- Overrides:
lineNumberPatternsin classAbstractSolver
-
start
Description copied from interface:ISolverStarts the solver; this is not an SMT-LIB command, but it is convenient in some implementations to separate the starting and initialization from the construction of the solver instance.- Specified by:
startin interfaceISolver- Overrides:
startin classAbstractSolver- Returns:
- success or an SMT error response
- See Also:
-
get_info
z3 reports a query stopped by its per-query time limit, -t:, with :reason-unknown "canceled" in incremental mode (after a push; checked with z3 4.16.0 and 5.1.0, while 4.8.12 and 4.12.6 give up first, as incomplete), and in every mode in 4.6 and 4.7; one-shot queries in newer versions, and other solvers such as cvc5, report "timeout". jSMTLIB sets no other limit that cancels a query, so when the per-query limit is set, "canceled" is reported as "timeout" (OpenJML#1022).- Specified by:
get_infoin interfaceISolver- Overrides:
get_infoin classAbstractSolver- Parameters:
key- the info keyword- Returns:
- the info value, or unsupported, or an SMT error response
- See Also:
-
isTimeLimitResponse
z3 answers 'timeout' (instead of a result) when its whole-run limit, -T:, ends it, and then exits (checked with z3 4.16.0 and 5.1.0)- Overrides:
isTimeLimitResponsein classAbstractSolver
-
answeredAfter
The kinds of command after which this z3 still answers the get- commands about the last check (probed 2026-10-29: z3 4.6 to 5.1 after every declare and define; 4.8 and later also after reset-assertions, which 4.6 and 4.7 report themselves). After assert, push or pop z3 reports the error itself. -
get_assignment
z3 answers get-assignment with :produce-assignments off, and in assert mode after a check- Specified by:
get_assignmentin interfaceISolver- Overrides:
get_assignmentin classAbstractSolver- Returns:
- a list of name–Boolean pairs, unsupported, or an SMT error response
- See Also:
-
get_model
z3 answers get-model in assert mode after a check- Specified by:
get_modelin interfaceISolver- Overrides:
get_modelin classAbstractSolver- Returns:
- a model, unsupported, or an SMT error response
- See Also:
-
get_value
z3 answers get-value in assert mode after a check- Specified by:
get_valuein interfaceISolver- Overrides:
get_valuein classAbstractSolver- Parameters:
terms- expressions to evaluate- Returns:
- a list of term–value pairs, unsupported, or an SMT error response
- See Also:
-
get_proof
z3 answers get-proof in assert mode after a check- Specified by:
get_proofin interfaceISolver- Overrides:
get_proofin classAbstractSolver- Returns:
- a proof, unsupported, or an SMT error response
- See Also:
-
check_sat
Description copied from interface:ISolverChecks whether the current assertion set is satisfiable under the current logic.- Specified by:
check_satin interfaceISolver- Overrides:
check_satin classAbstractSolver- Returns:
- sat, unsat, unknown, or an SMT error response
- See Also:
-
check_sat_assuming
Description copied from interface:ISolverChecks satisfiability under the current assertion set plus the given propositional assumptions.- Specified by:
check_sat_assumingin interfaceISolver- Overrides:
check_sat_assumingin classAbstractSolver- Returns:
- sat, unsat, unknown, or an SMT error response
- See Also:
-
reset
Description copied from interface:ISolverResets the solver to the initial state, clearing all assertions, declarations, and options.- Specified by:
resetin interfaceISolver- Overrides:
resetin classAbstractSolver- Returns:
- success or an SMT error response
- See Also:
-
unsatCoreElements
Drops the assumptions z3 adds to the unsat core (see Assumptions)- Overrides:
unsatCoreElementsin classAbstractSolver
-
unsatAssumptionsElements
Drops the labels z3 adds to the unsat assumptions (see Assumptions)- Overrides:
unsatAssumptionsElementsin classAbstractSolver
-
get_unsat_core
z3 answers get-unsat-core in assert mode after a check- Specified by:
get_unsat_corein interfaceISolver- Overrides:
get_unsat_corein classAbstractSolver- Returns:
- a list of formula names, unsupported, or an SMT error response
- See Also:
-
get_unsat_assumptions
z3 answers get-unsat-assumptions in assert mode after a check- Specified by:
get_unsat_assumptionsin interfaceISolver- Overrides:
get_unsat_assumptionsin classAbstractSolver- Returns:
- a list of assumption literals, unsupported, or an SMT error response
- See Also:
-