Package org.smtlib
Class Utils
java.lang.Object
org.smtlib.Utils
A class of static utility methods and constants for the SMT-LIB package.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA checked exception used internally to propagate SMT-LIB errors that carry an IResponse.IError. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IExpr.ISymbolstatic final IExpr.IKeywordThe string designating an info itemstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final StringThe String for the as reserved wordstatic final IExpr.IKeywordThe string designating an info itemstatic final IExpr.ISymbolstatic final IExpr.IKeywordThe string designating an info itemstatic final StringThe response to the :authors info itemstatic final StringName of the BitVector sortstatic final IExpr.ISymbolCanonical ISymbol form of BITVEC, for structural comparison against a parsed identifier's head symbol (see TypeChecker.isBitVec() and SymbolTable's bit-vector family check) instead of comparing via .toString().The set of standard options with boolean valuesstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolHead of the Strings theory's (_ char H) constants.static final IExpr.ISymbolstatic final StringAn ERROR_BEHAVIOR return valuestatic final StringName of the Core theoryfinal Map<String, IAttributeValue> The set of default values for all standard optionsstatic final StringThe string designating an option itemstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.IKeywordThe string designating an info itemstatic final StringThe String for the exists reserved wordstatic final IExpr.ISymbolstatic final StringThe string designating an option itemstatic final IExpr.ISymbolstatic final IExpr.ISymbolSymbol constant for boolean false.static final IExpr.ISymbolstatic final IExpr.ISymbolShort names for common FloatingPoint sorts (FloatingPoint.smt2's :notes documents each as a synonym for a specific (_ FloatingPoint eb sb) instance) -- resolved by SymbolTable.lookupSort() to the exact same ISort.IDefinition as that instance, not registered as their own independent sorts (see Utils.loadTheory(), which excludes them from the generic :sorts loader for the same reason).static final IExpr.ISymbolstatic final IExpr.ISymbolstatic final Stringstatic final IExpr.ISymbolCanonical ISymbol form of FLOATINGPOINT, for structural comparison against a parsed identifier's head symbol (see TypeChecker.isFloatingPoint() and SymbolTable's FloatingPoint family check) instead of comparing via .toString().static final StringThe String for the forall reserved wordstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolZero-arity indexed identifiers, e.g.static final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.IKeywordThe attribute tag for defining functions in a theorystatic final IExpr.ISymbolstatic final StringThe string designating an option itemstatic final IExpr.ISymbolstatic final StringAn ERROR_BEHAVIOR return valuestatic final IExpr.ISymbolstatic final StringA REASON_UNKNOWN return valuestatic final HashSet<IExpr.IKeyword> static final IExpr.ISymbolstatic final StringThe string designating an option itemstatic final StringThe String for the head of a datatype tester, (_ is C)static final IExpr.ISymbolstatic final IExpr.ISymbolstatic final StringThe String for the let reserved wordstatic final StringThe String for the logic symbolstatic final IExpr.ISymbolstatic final StringA REASON_UNKNOWN return valuestatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.IKeywordThe string designating an info itemstatic final StringThe response to the :name info itemstatic final IExpr.ISymbolThe set of standard options with numeric valuesstatic final IExpr.ISymbolstatic final StringThe String for the par reserved wordstatic final StringThe ID of the core functionality plug-instatic final IExpr.ISymbolstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe string designating an option itemstatic final StringThe suffix for adapter properties, as in org.smtlib.solver_ZZZ.adapterstatic final StringThe suffix for command-line properties, as in org.smtlib.solver_ZZZ.commandstatic final StringThe property name that specifies the default solverstatic final StringThe suffix for executable properties, as in org.smtlib.solver_ZZZ.execstatic final StringThe name of the properties file read by jSMTLIBstatic final StringThe property giving the default logic pathstatic final StringThe default prefix for the property names that identify solver executables, as in org.smtlib.solver_ZZZstatic final StringThe string designating an option itemstatic final IExpr.IKeywordThe string designating an info itemstatic final StringThe string designating an option itemstatic final IExpr.ISymbolstatic final StringThe string designating an option itemstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final HashSet<IExpr.IKeyword> The attributes the standard defines for set-info (any other is allowed, but not standard)static final IExpr.ISymbolstatic final IExpr.ISymbolprotected SMT.ConfigurationA reference to the configuration being used for this instance of Utils.static final IExpr.IKeywordThe string designating the smtlib attribute within a logic or theorystatic final IExpr.IKeywordThe attribute tag for defining sorts in a theoryThe standard options that may be set only in start mode, i.e.static final IExpr.IKeywordThe string designating an info itemstatic final StringThe String for the stderr predefined stringstatic final StringThe String for the stdout predefined stringstatic final IExpr.ISymbolThe set of standard options with string valuesstatic final StringThe suffix used for SMT-LIB filesstatic final StringThe name of the test solver, implemented by this SMT app.static final IExpr.IKeywordThe attribute tag for defining theories in a logicstatic final StringThe String for the theory symbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolstatic final IExpr.ISymbolSymbol constant for boolean true.static final IExpr.ISymbolBitvector/Int conversions and overflow predicates (SMT-LIB 2.7 FixedSizeBitVectors).static final StringThe string designating an option itemstatic final IExpr.IKeywordThe string designating an info itemstatic final StringThe String for the _ wildcard in match patternsstatic final IExpr.ISymbolstatic final IExpr.ISymbol -
Constructor Summary
ConstructorsConstructorDescriptionUtils(SMT.Configuration smtConfig) Creates a Utils instance for the given configuration -
Method Summary
Modifier and TypeMethodDescriptionasSort(ISexpr sexpr, SymbolTable symtab) Reads a logic file, parses it, validates the name, and checks the version.findTheory(String name, String path) Reads a theory file, returning the S-expression that it holds.static StringinvalidSetInfoValue(IExpr.IKeyword key, IAttributeValue value) The reason value is not a valid value for the standard set-info attribute key, or null if it is valid or key is not a standard set-info attributestatic voidCalled at branches that should never be executed in a correct program; prints a stack trace so that JaCoCo coverage failures are immediately visible at runtime.loadLogic(String logicName, SymbolTable symTable, IPos pos) Finds and loads a logic into the given symbol tableloadLogic(ILogic logicExpr, SymbolTable symTable) loadTheory(String theoryName, SymbolTable symTable) Loads a theory into the given symbol table.loadTheory(ITheory theory, SymbolTable symTable) static StringproduceAssertionsKey(SMT.Configuration smtConfig) Returns the name of the option that gates get-assertions -- renamed from :interactive-mode to :produce-assertions in SMT-LIB 2.5.Quotes a string, adding enclosing quotes and putting in SMT-LIBv2 escapes as neededstatic intsourceLine(ICommand cmd) The line of its source on which the command starts (counted from 1), or 0 if it has no source positionConverts a quoted string (which has enclosing double quotes) to a raw sequence of ASCII characters, undoing any SMT-LIBv2 escape sequences, and without the enclosing quotes
-
Field Details
-
PROPS_FILE
The name of the properties file read by jSMTLIB- See Also:
-
PROPS_DEFAULT_SOLVER
The property name that specifies the default solver- See Also:
-
PROPS_SOLVER_PREFIX
The default prefix for the property names that identify solver executables, as in org.smtlib.solver_ZZZ- See Also:
-
PROPS_ADAPTER_SUFFIX
The suffix for adapter properties, as in org.smtlib.solver_ZZZ.adapter- See Also:
-
PROPS_EXEC_SUFFIX
The suffix for executable properties, as in org.smtlib.solver_ZZZ.exec- See Also:
-
PROPS_COMMAND_SUFFIX
The suffix for command-line properties, as in org.smtlib.solver_ZZZ.command- See Also:
-
PROPS_LOGIC_PATH
The property giving the default logic path- See Also:
-
TEST_SOLVER
The name of the test solver, implemented by this SMT app.- See Also:
-
PLUGIN_ID
The ID of the core functionality plug-in- See Also:
-
SUFFIX
The suffix used for SMT-LIB files- See Also:
-
CORE
Name of the Core theory- See Also:
-
BITVEC
Name of the BitVector sort- See Also:
-
PRINT_SUCCESS
The string designating an option item- See Also:
-
INTERACTIVE_MODE
The string designating an option item- See Also:
-
PRODUCE_ASSERTIONS
The string designating an option item- See Also:
-
GLOBAL_DECLARATIONS
The string designating an option item- See Also:
-
RANDOM_SEED
The string designating an option item- See Also:
-
REPRODUCIBLE_RESOURCE_LIMIT
The string designating an option item- See Also:
-
VERBOSITY
The string designating an option item- See Also:
-
EXPAND_DEFINITIONS
The string designating an option item- See Also:
-
REGULAR_OUTPUT_CHANNEL
The string designating an option item- See Also:
-
DIAGNOSTIC_OUTPUT_CHANNEL
The string designating an option item- See Also:
-
PRODUCE_PROOFS
The string designating an option item- See Also:
-
PRODUCE_ASSIGNMENTS
The string designating an option item- See Also:
-
PRODUCE_UNSAT_CORES
The string designating an option item- See Also:
-
PRODUCE_UNSAT_ASSUMPTIONS
The string designating an option item- See Also:
-
PRODUCE_MODELS
The string designating an option item- See Also:
-
startModeOptions
The standard options that may be set only in start mode, i.e. before set-logic (SMT-LIB 2.7, 4.1.7) -
ERROR_BEHAVIOR
The string designating an info item -
NAME
The string designating an info item -
AUTHORS
The string designating an info item -
VERSION
The string designating an info item -
STATUS
The string designating an info item -
REASON_UNKNOWN
The string designating an info item -
ALL_STATISTICS
The string designating an info item -
ASSERTION_STACK_LEVELS
The string designating an info item -
AUTHORS_VALUE
The response to the :authors info item- See Also:
-
NAME_VALUE
The response to the :name info item- See Also:
-
SMTLIB_VERSION
The string designating the smtlib attribute within a logic or theory -
SORTS
The attribute tag for defining sorts in a theory -
FUNS
The attribute tag for defining functions in a theory -
THEORIES
The attribute tag for defining theories in a logic -
CONTINUED_EXECUTION
An ERROR_BEHAVIOR return value- See Also:
-
IMMEDIATE_EXIT
An ERROR_BEHAVIOR return value- See Also:
-
MEMOUT
A REASON_UNKNOWN return value- See Also:
-
INCOMPLETE
A REASON_UNKNOWN return value- See Also:
-
LOGIC
The String for the logic symbol- See Also:
-
THEORY
The String for the theory symbol- See Also:
-
IS
The String for the head of a datatype tester, (_ is C)- See Also:
-
PAR
The String for the par reserved word- See Also:
-
AS
The String for the as reserved word- See Also:
-
LET
The String for the let reserved word- See Also:
-
FORALL
The String for the forall reserved word- See Also:
-
EXISTS
The String for the exists reserved word- See Also:
-
WILDCARD
The String for the _ wildcard in match patterns- See Also:
-
STDOUT
The String for the stdout predefined string- See Also:
-
STDERR
The String for the stderr predefined string- See Also:
-
TRUE
Symbol constant for boolean true. -
FALSE
Symbol constant for boolean false. -
NOT
-
AND
-
OR
-
IMPLIES
-
EQ
-
DISTINCT
-
ITE
-
XOR
-
PLUS
-
MINUS
-
MULT
-
SLASH
-
DIV
-
MOD
-
ABS
-
EXP
-
GE
-
GT
-
LE
-
LT
-
STORE
-
SELECT
-
ARRAY
-
ARROW
-
AT
-
BVNOT
-
BVNEG
-
BVAND
-
BVOR
-
BVADD
-
BVMUL
-
BVUDIV
-
BVUREM
-
BVSHL
-
BVLSHR
-
BVNAND
-
BVNOR
-
BVXOR
-
BVXNOR
-
BVSUB
-
BVSDIV
-
BVSREM
-
BVSMOD
-
BVASHR
-
BVCOMP
-
BVULT
-
BVULE
-
BVUGT
-
BVUGE
-
BVSLT
-
BVSLE
-
BVSGT
-
BVSGE
-
CONCAT
-
EXTRACT
-
CHAR
Head of the Strings theory's (_ char H) constants. -
REPEAT
-
ZERO_EXTEND
-
SIGN_EXTEND
-
ROTATE_LEFT
-
ROTATE_RIGHT
-
UBV_TO_INT
Bitvector/Int conversions and overflow predicates (SMT-LIB 2.7 FixedSizeBitVectors). -
SBV_TO_INT
-
INT_TO_BV
-
BVNEGO
-
BVUADDO
-
BVSADDO
-
BVUMULO
-
BVSMULO
-
BITVEC_SYM
Canonical ISymbol form of BITVEC, for structural comparison against a parsed identifier's head symbol (see TypeChecker.isBitVec() and SymbolTable's bit-vector family check) instead of comparing via .toString(). -
FLOATINGPOINT
- See Also:
-
FLOATINGPOINT_SYM
Canonical ISymbol form of FLOATINGPOINT, for structural comparison against a parsed identifier's head symbol (see TypeChecker.isFloatingPoint() and SymbolTable's FloatingPoint family check) instead of comparing via .toString(). -
FLOAT16
Short names for common FloatingPoint sorts (FloatingPoint.smt2's :notes documents each as a synonym for a specific (_ FloatingPoint eb sb) instance) -- resolved by SymbolTable.lookupSort() to the exact same ISort.IDefinition as that instance, not registered as their own independent sorts (see Utils.loadTheory(), which excludes them from the generic :sorts loader for the same reason). -
FLOAT32
-
FLOAT64
-
FLOAT128
-
FP
-
FP_ABS
-
FP_NEG
-
FP_ADD
-
FP_SUB
-
FP_MUL
-
FP_DIV
-
FP_FMA
-
FP_SQRT
-
FP_REM
-
FP_ROUND_TO_INTEGRAL
-
FP_MIN
-
FP_MAX
-
FP_LEQ
-
FP_LT
-
FP_GEQ
-
FP_GT
-
FP_EQ
-
FP_IS_NORMAL
-
FP_IS_SUBNORMAL
-
FP_IS_ZERO
-
FP_IS_INFINITE
-
FP_IS_NAN
-
FP_IS_NEGATIVE
-
FP_IS_POSITIVE
-
FP_TO_REAL
-
FP_TO_UBV
-
FP_TO_SBV
-
FP_POS_INF
Zero-arity indexed identifiers, e.g. (_ +oo eb sb) -- head symbols, not full identifiers. -
FP_NEG_INF
-
FP_POS_ZERO
-
FP_NEG_ZERO
-
FP_NAN
-
TO_FP
-
TO_FP_UNSIGNED
-
ROUNDINGMODE_SYM
-
boolOptions
The set of standard options with boolean values -
numericOptions
The set of standard options with numeric values -
stringOptions
The set of standard options with string values -
defaults
The set of default values for all standard options -
infoKeywords
-
setInfoKeywords
The attributes the standard defines for set-info (any other is allowed, but not standard) -
smtConfig
A reference to the configuration being used for this instance of Utils.
-
-
Constructor Details
-
Utils
Creates a Utils instance for the given configuration
-
-
Method Details
-
sourceLine
The line of its source on which the command starts (counted from 1), or 0 if it has no source position -
produceAssertionsKey
Returns the name of the option that gates get-assertions -- renamed from :interactive-mode to :produce-assertions in SMT-LIB 2.5. -
invalidSetInfoValue
The reason value is not a valid value for the standard set-info attribute key, or null if it is valid or key is not a standard set-info attribute -
quote
Quotes a string, adding enclosing quotes and putting in SMT-LIBv2 escapes as needed- Parameters:
msg- String to quote- Returns:
- the quoted string
-
unescape
Converts a quoted string (which has enclosing double quotes) to a raw sequence of ASCII characters, undoing any SMT-LIBv2 escape sequences, and without the enclosing quotes -
findLogic
Reads a logic file, parses it, validates the name, and checks the version.- Parameters:
name- the logic name (and base filename)pos- source position for error messages, or null- Returns:
- the parsed ILogic
- Throws:
Utils.SMTLIBException- if the file cannot be found, parsed, or validated
-
findTheory
Reads a theory file, returning the S-expression that it holds.- Parameters:
name- the name of the theorypath- the directory path in which theory files are stored- Returns:
- the parsed ITheory
- Throws:
Utils.SMTLIBException- if an error occurs
-
loadLogic
Finds and loads a logic into the given symbol table- Parameters:
logicName- name of the logic to loadsymTable- the symbol table into which to load it- Returns:
- null if read OK, an error if a problem happened
-
loadTheory
Loads a theory into the given symbol table.- Parameters:
theoryName- the theory to loadsymTable- the symbol table into which to put the theory- Returns:
- null if OK, otherwise an error as a IResponse
-
loadLogic
-
loadTheory
-
asSort
-
jacocoNeverExecuted
public static void jacocoNeverExecuted()Called at branches that should never be executed in a correct program; prints a stack trace so that JaCoCo coverage failures are immediately visible at runtime.
-