Package org.smtlib
Class SMT.Configuration
java.lang.Object
org.smtlib.SMT.Configuration
- All Implemented Interfaces:
Cloneable,SMT.IConfiguration
- Enclosing class:
SMT
The configuration object holds the values of all of the current options (e.g. command-line
settings); it also holds factory objects that are used to create objects for the particular
concrete syntax being used; it also holds a few internal state values
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of the supported SMT-LIB versions, in declaration order from oldest to newest. -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanIf true, command processing in a solver aborts on the first errorString[]An array of fully-qualified class name prefixes; a command name (with hyphen replaced by underscore) is appended to the prefix to obtain a fully-qualified class name that implements the command.The factory to use to create ICommand objectsA class that implements ICommandFinder, whose one method returns the class object of the class that implements a command with a given name; the algorithm to identify the command class first looks for an entry in the command map above and otherwise uses this default: replace each - in the command name by _, and append the resulting string to the elements of 'commandExtensionPrefixes', looking for the first such class that exists; if relax is false (strict SMT-LIB) then the commands map and all but the initial entry of commandExtensionPrefixes are ignored.Holds a mapping from command name to the class implementing the commandThe default printer used to convert AST objects to strings for output.If non-null, the file name (or 'stdout'/'stderr') to use for diagnostic output.booleanTrue if the application is to echo commands as it executes them; only applies in interactiveMode modeThe path to the executable for the solver to useThe factory to use to create IExpr objectsThe files of SMT-LIB commands to process; if null or empty then the standard input is usedintInitial capacity in characters for the input reader's internal buffer.booleanThis variable records whether we are reading from standard input, in which case the input text is usually already present.The log to use for regular, error, and diagnostic outputThe file to which to write the communication, for debugging or reference; null means defaultThis field is set from the command-line; if set, then sets the logic used by the solver, as if the first command were the corresponding set-logic command.The path on which to find logic and theory definitionsbooleanIf true, then information about the position of an error is not shownbooleanThis field is set from the command-line and sets the initial state of the :print-success option within a solver.If non-null, the file name (or 'stdout'/'stderr') to use for regular output.booleanIf true, commands are sent to the solver without waiting for each response where that is possible (AbstractSolver.sendPipelined), and the responses are read as they arrive: by the command-line tool for file or --text input (--pipeline), and by IScript.execute (AbstractSolver.executePipelined)intThe port to use for socket communications; a port > 0 supersedes any file value, but is ignored if the text option is set.The prompt to use when needing new input from the user in an interactive mode.The prompt to use when in the middle of a commandProperties loaded from the jsmtlib.properties file(s); seereadProperties().booleanWhen true, allows some convenience relaxations of the SMTLIB standard; when false, the standard is strictly enforced.The version in which a reserved word became reserved, for those not reserved in V2.0A list of all reserved wordsA list of reserved words that are not commandsThe factory to use to create IResponse objectsintIf non-zero, a seed to pass to the solver to initialize its random number generator (--seed, non-negative)The factory to use to create IParser, IPos, ISource objectsThe version of SMT-LIB to be supported; null means the default (most recent version)The solver to useintThe verbosity level of the SMT solverThe factory to use to create ISort objectsThe PrintStream that "stderr" resolves to for this instance.The PrintStream that "stdout" resolves to for this instance.String[]booleanWhen true, a solver's raw response text is scrubbed of known non-deterministic content (elapsed-time figures, memory usage) before being parsed, replacing each with a fixed placeholder (e.g.A string containing the SMT-LIB commands to use; if null the given file is used; if non-null this text is used instead of the content of the file or the input from a port.doubleThe soft, per-query timeout, in seconds (fractional allowed), set via -t/--timeout; <=0 means no timeout.doubleThe whole-run (solver-process-lifetime) timeout, in seconds (fractional allowed), set via -T/--timeout-total; <=0 means no timeout.booleanEncodes an aspect of current parser state so that we know what kind of prompt to use.The utils object to use for utility methodsintTrue to emit diagnostic output through the SMT-LIB diagnostic channel -
Constructor Summary
ConstructorsConstructorDescriptionCreates a default configuration, initialized from org.smtlib.impl -
Method Summary
Modifier and TypeMethodDescriptionbooleanatLeastVersion(SMT.Configuration.SMTLIB version) Returns true if the configured version is at least the given version.clone()Makes an independent copy of the configuration: a shallow, reference-copying field-for-field clone (viasuper.clone()) is not enough on its own, since several fields are mutable containers or hold a back-reference to this Configuration -- left reference-copied, mutating one of those through the clone would silently mutate the original too, contradicting this class's own "Separate instances of SMT objects can be run independently and in parallel" design goal (see the class Javadoc).createSolver(String solvername, String executable) Resolves the given solver name and executable to a concreteISolveradapter instance, applying the same name/executable/adapter resolution jsmtlib.properties supports asSMT.startSolver(org.smtlib.SMT.Configuration, java.lang.String, java.lang.String)-- platform-specific.adapter/.execoverrides checked before their bare counterparts, theSolver_<name>naming convention, the z3-specificSolver_z3_recentfallback for an unrecognized z3 variant, the genericSolver_smtfallback, the"test"pseudo-solver special case, and%exec%command-array placeholder substitution -- but, unlikestartSolver, this method does not start the solver and does not do any CLI-flavorederror()/usage()reporting: any resolution or construction failure is reported as a thrownISolver.CreationExceptioninstead, leaving it to the caller to start the returned solver (viaISolver.start()) and decide how to report a creation failure.booleanisOKKeyword(String value) True if the string (including the colon) is a legal keyword: a colon followed by a simple symbol, that is, letters, digits and the characters~!@$%^&*_-+=<>.?/, not starting with a digit and not a reserved word.booleanisOKString(String value) True if the string, as the (unescaped) value of a string literal, is legal in the configured SMT-LIB version: printable and white-space characters only, those beyond ASCII only from V2.5 onbooleanisOKSymbol(String value) True if the string, as the value of a symbol (without enclosing bars), is a legal symbol in the configured SMT-LIB version: not a reserved word (|let| is the same symbol as let), without | or \, and of printable and white-space characters only, those beyond ASCII only from V2.5 onbooleanisReservedWord(String word) True if the word is reserved in the configured SMT-LIB version; with --relax, command names are notbooleanisVersion(SMT.Configuration.SMTLIB version) Returns true if the configured version equals the given version.
-
Field Details
-
reservedWordsNotCommands
A list of reserved words that are not commands -
reservedWords
A list of all reserved words -
reservedSince
The version in which a reserved word became reserved, for those not reserved in V2.0 -
smtlib
The version of SMT-LIB to be supported; null means the default (most recent version) -
verbose
public int verboseTrue to emit diagnostic output through the SMT-LIB diagnostic channel -
solverVerbosity
public int solverVerbosityThe verbosity level of the SMT solver -
timeout
public double timeoutThe soft, per-query timeout, in seconds (fractional allowed), set via -t/--timeout; <=0 means no timeout. SeetimeoutTotalfor the whole-run counterpart. jSMTLIB expresses both values in seconds regardless of solver; each solver adapter translates them into whatever unit, flag, and scope (per-query vs. whole-run) that solver's own binary actually supports -- see the per-adapter comments where timeout/timeoutTotal are read. -
timeoutTotal
public double timeoutTotalThe whole-run (solver-process-lifetime) timeout, in seconds (fractional allowed), set via -T/--timeout-total; <=0 means no timeout. Seetimeoutfor the per-query counterpart and the general unit/translation note there. -
nosuccess
public boolean nosuccessThis field is set from the command-line and sets the initial state of the :print-success option within a solver. -
abort
public boolean abortIf true, command processing in a solver aborts on the first error -
echo
public boolean echoTrue if the application is to echo commands as it executes them; only applies in interactiveMode mode -
pipeline
public boolean pipelineIf true, commands are sent to the solver without waiting for each response where that is possible (AbstractSolver.sendPipelined), and the responses are read as they arrive: by the command-line tool for file or --text input (--pipeline), and by IScript.execute (AbstractSolver.executePipelined) -
logic
This field is set from the command-line; if set, then sets the logic used by the solver, as if the first command were the corresponding set-logic command. -
solvername
The solver to use -
executable
The path to the executable for the solver to use -
logfile
The file to which to write the communication, for debugging or reference; null means default -
files
The files of SMT-LIB commands to process; if null or empty then the standard input is used -
text
A string containing the SMT-LIB commands to use; if null the given file is used; if non-null this text is used instead of the content of the file or the input from a port. A typical use is when the SMT text is generated rather than read. -
noshow
public boolean noshowIf true, then information about the position of an error is not shown -
seed
public int seedIf non-zero, a seed to pass to the solver to initialize its random number generator (--seed, non-negative) -
out
If non-null, the file name (or 'stdout'/'stderr') to use for regular output. -
diag
If non-null, the file name (or 'stdout'/'stderr') to use for diagnostic output. -
port
public int portThe port to use for socket communications; a port > 0 supersedes any file value, but is ignored if the text option is set. -
log
The log to use for regular, error, and diagnostic output -
props
Properties loaded from the jsmtlib.properties file(s); seereadProperties(). -
stdout
The PrintStream that "stdout" resolves to for this instance. Defaults to System.out; in-process callers (e.g. JUnit tests) set this to a per-test stream so that set_option(:regular-output-channel "stdout") does not escape the capture. -
stderr
The PrintStream that "stderr" resolves to for this instance. Defaults to System.err; in-process callers (e.g. JUnit tests) set this to a per-test stream so that set_option(:diagnostic-output-channel "stderr") does not escape the capture. -
utils
The utils object to use for utility methods -
relax
public boolean relaxWhen true, allows some convenience relaxations of the SMTLIB standard; when false, the standard is strictly enforced. -
testing
public boolean testingWhen true, a solver's raw response text is scrubbed of known non-deterministic content (elapsed-time figures, memory usage) before being parsed, replacing each with a fixed placeholder (e.g. TIME, VALUE) so that otherwise-identical output is byte-for-byte reproducible across runs and machines. Off by default -- this is a testing aid, not a normal end-user option. Currently applied only withinAbstractSolver.get_info(IExpr.IKeyword), the one place this instability has actually been observed (cvc5's :all-statistics response, and :memory/ :max-memory figures on several solvers). -
commandExtensionPrefixes
An array of fully-qualified class name prefixes; a command name (with hyphen replaced by underscore) is appended to the prefix to obtain a fully-qualified class name that implements the command. -
strictCommandExtensionPrefixes
-
logicPath
The path on which to find logic and theory definitions -
prompt
The prompt to use when needing new input from the user in an interactive mode. -
prompt2
The prompt to use when in the middle of a command -
sortFactory
The factory to use to create ISort objects -
responseFactory
The factory to use to create IResponse objects -
exprFactory
The factory to use to create IExpr objects -
commandFactory
The factory to use to create ICommand objects -
smtFactory
The factory to use to create IParser, IPos, ISource objects -
defaultPrinter
The default printer used to convert AST objects to strings for output. -
initialInputBufferSize
public int initialInputBufferSizeInitial capacity in characters for the input reader's internal buffer. -
commands
Holds a mapping from command name to the class implementing the command -
commandFinder
A class that implements ICommandFinder, whose one method returns the class object of the class that implements a command with a given name; the algorithm to identify the command class first looks for an entry in the command map above and otherwise uses this default: replace each - in the command name by _, and append the resulting string to the elements of 'commandExtensionPrefixes', looking for the first such class that exists; if relax is false (strict SMT-LIB) then the commands map and all but the initial entry of commandExtensionPrefixes are ignored. -
interactive
public boolean interactiveThis variable records whether we are reading from standard input, in which case the input text is usually already present. If this field is true, then we prompt when we need additional input and we do not need to echo back an invalid command. -
topLevel
public boolean topLevelEncodes an aspect of current parser state so that we know what kind of prompt to use.
-
-
Constructor Details
-
Configuration
public Configuration()Creates a default configuration, initialized from org.smtlib.impl
-
-
Method Details
-
clone
Makes an independent copy of the configuration: a shallow, reference-copying field-for-field clone (viasuper.clone()) is not enough on its own, since several fields are mutable containers or hold a back-reference to this Configuration -- left reference-copied, mutating one of those through the clone would silently mutate the original too, contradicting this class's own "Separate instances of SMT objects can be run independently and in parallel" design goal (see the class Javadoc). commands/reservedWords/reservedWordsNotCommands/utils/log are each given their own fresh copy below for exactly this reason.- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
isReservedWord
True if the word is reserved in the configured SMT-LIB version; with --relax, command names are not -
isOKSymbol
True if the string, as the value of a symbol (without enclosing bars), is a legal symbol in the configured SMT-LIB version: not a reserved word (|let| is the same symbol as let), without | or \, and of printable and white-space characters only, those beyond ASCII only from V2.5 on -
isOKKeyword
True if the string (including the colon) is a legal keyword: a colon followed by a simple symbol, that is, letters, digits and the characters~!@$%^&*_-+=<>.?/, not starting with a digit and not a reserved word. The standard's example :56 contradicts this (#185). -
isOKString
True if the string, as the (unescaped) value of a string literal, is legal in the configured SMT-LIB version: printable and white-space characters only, those beyond ASCII only from V2.5 on -
isVersion
Returns true if the configured version equals the given version. -
atLeastVersion
Returns true if the configured version is at least the given version. Uses enum declaration order: V20 < V25 < V26 < V27. -
readProperties
-
createSolver
Resolves the given solver name and executable to a concreteISolveradapter instance, applying the same name/executable/adapter resolution jsmtlib.properties supports asSMT.startSolver(org.smtlib.SMT.Configuration, java.lang.String, java.lang.String)-- platform-specific.adapter/.execoverrides checked before their bare counterparts, theSolver_<name>naming convention, the z3-specificSolver_z3_recentfallback for an unrecognized z3 variant, the genericSolver_smtfallback, the"test"pseudo-solver special case, and%exec%command-array placeholder substitution -- but, unlikestartSolver, this method does not start the solver and does not do any CLI-flavorederror()/usage()reporting: any resolution or construction failure is reported as a thrownISolver.CreationExceptioninstead, leaving it to the caller to start the returned solver (viaISolver.start()) and decide how to report a creation failure.- Parameters:
solvername- the name of the solver to useexecutable- the executable path, or null to resolve one from jsmtlib.properties or (absent any properties entry) from the solver name itself- Returns:
- a constructed, not-yet-started ISolver adapter instance
- Throws:
ISolver.CreationException- if the adapter class or its constructor cannot be resolved, or construction otherwise fails
-