Package org.smtlib.solvers
Class Solver_test
java.lang.Object
org.smtlib.solvers.Solver_test
- All Implemented Interfaces:
ISolver
This class is a Solver implementation that simply type-checks formulae and checks that
commands are used correctly; it does not do any proving.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.smtlib.ISolver
ISolver.CreationException -
Field Summary
FieldsModifier and TypeFieldDescriptionThe solver's assertion set stack, one frame per push level, top first.protected IResponseInternal state variable - set to sat, unsat, unknown when check-sat is run and then to null whenever an additional push, pop, assert, declare- or define- command is executed.protected StringInternal state variable - set non-null once the logic is set.protected Map<String, IAttributeValue> The data structure that maintains the current values of options and info items for this solver.protected SMT.ConfigurationA reference to the configuration used by this SMT instance.The symbol table used by this solver -
Constructor Summary
ConstructorsConstructorDescriptionSolver_test(SMT.Configuration smtConfig, String exec) Constructor for an instance of this test solver class; the second argument is ignored - it is present just for uniformity with other solvers, for which that argument is a path to the relevant executable. -
Method Summary
Modifier and TypeMethodDescriptionassertExpr(IExpr expr) Adds the given expression to the current assertion-stack frame.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.Returns the result of the most recent check-sat or check-sat-assuming, or null if none has been issued since the last push/pop/assert/declare/define.voidPasses comment text to the solver (for logging/tracing); the argument is the comment body without the leading semicolon.Declares a new uninterpreted constant; returns success or an SMT error responseDeclares a new datatype sort; returns success or an SMT error responseDeclares mutually recursive datatype sorts; returns success or an SMT error responseDeclares a new uninterpreted function (or constant); returns success or an SMT error responseDeclares a new uninterpreted sort; returns success or an SMT error responseDeclares a new sort parameter (polymorphic sort variable); returns success or an SMT error responseDefines a named constant — syntactic sugar fordefine-funwith no parameters; returns success or an SMT error responseDefines a named function or constant; returns success or an SMT error responseDefines a named recursive function; returns success or an SMT error responseDefines a group of mutually recursive functions; returns success or an SMT error responseDefines a sort abbreviation; returns success or an SMT error responseecho(IExpr.IStringLiteral arg) Echoes the argument string back to the output channel.protected StringOnce exited, every command but exit (and a comment) answers as a process-based solver's wouldexit()Terminates the solver; no further commands are permitted.voidTerminates the solver forcibly without sending commands (e.g.Returns the list of formulae in the current assertion set, in the order they were asserted.Returns the truth-value assignments for all named Boolean formulae in the current model.get_info(IExpr.IKeyword key) Returns the value of the named info item.Returns a satisfying model for the current assertion set.get_option(IExpr.IKeyword key) Returns the current value of the named option.Returns a proof of unsatisfiability for the current assertion set.Returns the subset of check-sat-assuming assumptions that caused the result to be unsat.Returns the named formulae that form an unsatisfiable core of the current assertion set.Returns the values of the given expressions in the current satisfying model.pop(int number) Removes the given number of assertion-stack frames from the solver state.push(int number) Adds the given number of empty assertion-stack frames to the solver state.reset()Resets the solver to the initial state, clearing all assertions, declarations, and options.Removes asserted formulae (but not global declarations when :global-declarations is true).set_info(IExpr.IKeyword key, IAttributeValue value) Annotates the problem with an info attribute (e.g.Sets the logic the solver should use.set_option(IExpr.IKeyword key, IAttributeValue value) Sets an SMT-LIB option.smt()Returns the reference to the configuration currently in use.A public, user-readable name for the solver adapter classstart()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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.smtlib.ISolver
setSourceLine
-
Field Details
-
smtConfig
A reference to the configuration used by this SMT instance. -
symTable
The symbol table used by this solver -
assertionSetStack
The solver's assertion set stack, one frame per push level, top first. Once the logic is set it always has at least one frame: start() and reset() add the base frame and pop() cannot remove it. The base frame holds the assertions made outside any push. Declarations live in symTable, which has one more frame: each frame here pairs with the symTable frame of the same level (the base frame with its primary frame), and symTable's bottom, background frame holds the logic's symbols and the global declarations. -
logicSet
Internal state variable - set non-null once the logic is set. -
checkSatStatus
Internal state variable - set to sat, unsat, unknown when check-sat is run and then to null whenever an additional push, pop, assert, declare- or define- command is executed. This is used in checking those commands that depend on the above set of conditions. -
options
The data structure that maintains the current values of options and info items for this solver.
-
-
Constructor Details
-
Solver_test
Constructor for an instance of this test solver class; the second argument is ignored - it is present just for uniformity with other solvers, for which that argument is a path to the relevant executable. This constructor is called by reflection, upon knowing the name of the solver ("test").- Parameters:
smtConfig- a reference to the configuration instance in useexec- the executable for the solver, ignored for the case of this test solver
-
-
Method Details
-
solverName
Description copied from interface:ISolverA public, user-readable name for the solver adapter class- Specified by:
solverNamein interfaceISolver
-
smt
Returns the reference to the configuration currently in use. -
checkSatStatus
Description copied from interface:ISolverReturns the result of the most recent check-sat or check-sat-assuming, or null if none has been issued since the last push/pop/assert/declare/define.- Specified by:
checkSatStatusin interfaceISolver
-
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. -
reset
Description copied from interface:ISolverResets the solver to the initial state, clearing all assertions, declarations, and options. -
comment
Description copied from interface:ISolverPasses comment text to the solver (for logging/tracing); the argument is the comment body without the leading semicolon. -
reset_assertions
Description copied from interface:ISolverRemoves asserted formulae (but not global declarations when :global-declarations is true).- Specified by:
reset_assertionsin interfaceISolver- Returns:
- success or an SMT error response
-
execute
Once exited, every command but exit (and a comment) answers as a process-based solver's would -
exit
Description copied from interface:ISolverTerminates the solver; no further commands are permitted. -
forceExit
public void forceExit()Description copied from interface:ISolverTerminates the solver forcibly without sending commands (e.g. by killing the process). -
echo
Description copied from interface:ISolverEchoes the argument string back to the output channel. -
assertExpr
Description copied from interface:ISolverAdds the given expression to the current assertion-stack frame. The SMT-LIB command name isassert; the Java method name differs to avoid the Java reserved word.- Specified by:
assertExprin interfaceISolver- Returns:
- success or an SMT error response
-
get_assertions
Description copied from interface:ISolverReturns the list of formulae in the current assertion set, in the order they were asserted. Requires :produce-assertions to be enabled; returns an error if it is not. SMT-LIB does not stipulate the order of the terms in the returned list.- Specified by:
get_assertionsin interfaceISolver- Returns:
- a sequence of asserted terms, unsupported, or an SMT error response
-
check_sat
Description copied from interface:ISolverChecks whether the current assertion set is satisfiable under the current logic. -
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- Returns:
- sat, unsat, unknown, or an SMT error response
-
get_value
Description copied from interface:ISolverReturns the values of the given expressions in the current satisfying model. Requires :produce-models to be enabled and the last check-sat to have returned sat; returns an error if these preconditions are not met. -
get_assignment
Description copied from interface:ISolverReturns the truth-value assignments for all named Boolean formulae in the current model. Requires :produce-assignments to be enabled and the last check-sat to have returned sat; returns an error if these preconditions are not met.- Specified by:
get_assignmentin interfaceISolver- Returns:
- a list of name–Boolean pairs, unsupported, or an SMT error response
-
get_proof
Description copied from interface:ISolverReturns a proof of unsatisfiability for the current assertion set. Requires :produce-proofs to be enabled; returns an error if it is not. -
get_model
Description copied from interface:ISolverReturns a satisfying model for the current assertion set. Requires :produce-models to be enabled and the last check-sat to have returned sat; returns an error if these preconditions are not met. -
get_unsat_assumptions
Description copied from interface:ISolverReturns the subset of check-sat-assuming assumptions that caused the result to be unsat. Requires :produce-unsat-assumptions to be enabled; returns an error if it is not.- Specified by:
get_unsat_assumptionsin interfaceISolver- Returns:
- a list of assumption literals, unsupported, or an SMT error response
-
get_unsat_core
Description copied from interface:ISolverReturns the named formulae that form an unsatisfiable core of the current assertion set. Requires :produce-unsat-cores to be enabled; returns an error if it is not.- Specified by:
get_unsat_corein interfaceISolver- Returns:
- a list of formula names, unsupported, or an SMT error response
-
pop
Description copied from interface:ISolverRemoves the given number of assertion-stack frames from the solver state. -
push
Description copied from interface:ISolverAdds the given number of empty assertion-stack frames to the solver state. -
set_logic
Description copied from interface:ISolverSets the logic the solver should use. -
set_option
Description copied from interface:ISolverSets an SMT-LIB option.- Specified by:
set_optionin interfaceISolver- Parameters:
key- the keyword naming the optionvalue- the value to set- Returns:
- success, unsupported, or an SMT error response
-
get_option
Description copied from interface:ISolverReturns the current value of the named option.- Specified by:
get_optionin interfaceISolver- Parameters:
key- the keyword naming the option- Returns:
- the option value, or unsupported, or an SMT error response
-
set_info
Description copied from interface:ISolverAnnotates the problem with an info attribute (e.g.:status sat). -
get_info
Description copied from interface:ISolverReturns the value of the named info item. -
encode
-
declare_const
Description copied from interface:ISolverDeclares a new uninterpreted constant; returns success or an SMT error response- Specified by:
declare_constin interfaceISolver
-
declare_fun
Description copied from interface:ISolverDeclares a new uninterpreted function (or constant); returns success or an SMT error response- Specified by:
declare_funin interfaceISolver
-
define_const
Description copied from interface:ISolverDefines a named constant — syntactic sugar fordefine-funwith no parameters; returns success or an SMT error response- Specified by:
define_constin interfaceISolver
-
define_fun
Description copied from interface:ISolverDefines a named function or constant; returns success or an SMT error response- Specified by:
define_funin interfaceISolver
-
define_fun_rec
Description copied from interface:ISolverDefines a named recursive function; returns success or an SMT error response- Specified by:
define_fun_recin interfaceISolver
-
define_funs_rec
Description copied from interface:ISolverDefines a group of mutually recursive functions; returns success or an SMT error response- Specified by:
define_funs_recin interfaceISolver
-
declare_sort
Description copied from interface:ISolverDeclares a new uninterpreted sort; returns success or an SMT error response- Specified by:
declare_sortin interfaceISolver
-
declare_sort_parameter
Description copied from interface:ISolverDeclares a new sort parameter (polymorphic sort variable); returns success or an SMT error response- Specified by:
declare_sort_parameterin interfaceISolver
-
define_sort
Description copied from interface:ISolverDefines a sort abbreviation; returns success or an SMT error response- Specified by:
define_sortin interfaceISolver
-
declare_datatype
Description copied from interface:ISolverDeclares a new datatype sort; returns success or an SMT error response- Specified by:
declare_datatypein interfaceISolver
-
declare_datatypes
Description copied from interface:ISolverDeclares mutually recursive datatype sorts; returns success or an SMT error response- Specified by:
declare_datatypesin interfaceISolver
-