Package org.smtlib.logic
Class Logic
java.lang.Object
org.smtlib.impl.Pos.Posable
org.smtlib.impl.Pos.Printable
org.smtlib.impl.SMTExpr.Logic
org.smtlib.logic.Logic
- All Implemented Interfaces:
ILanguage,ILogic,INode,IPos.IPosable
- Direct Known Subclasses:
ALL,AUFLIA,AUFLIRA,AUFNIRA,DifferenceLogic,LIA,LRA,QF_AUFLIA,QF_AX,QF_BV,QF_EIA,QF_FP,QF_NIA,QF_NRA,QF_UF,QF_UFIDL,UFNIA
Common base for this package's per-logic syntactic-restriction classes (QF_IDL, LRA,
QF_UF, etc). Each subclass overrides
ILanguage.validExpression(org.smtlib.IExpr),
ILanguage.checkFcnDeclaration(org.smtlib.IExpr.IIdentifier, java.util.List<org.smtlib.ISort>, org.smtlib.ISort, org.smtlib.IExpr), and ILanguage.checkSortDeclaration(org.smtlib.IExpr.IIdentifier, java.util.List<org.smtlib.ISort.IParameter>, org.smtlib.ISort) to
reject whatever its own logic's SMT-LIB-mandated grammar forbids (quantifiers,
uninterpreted functions, nonlinear arithmetic, unrestricted sorts, ...); this class
supplies the shared helpers those overrides call (noQuantifiers, noFunctions, noSorts,
checkArraySort, isLinearReal, ...).
Extends SMTExpr.Logic (the plain, unrestricted ILogic implementation
sexpr.Parser falls back to when no subclass exists for a given logic name -- see
issue #46) rather than depending only on the bare ILogic interface, so that a
subclass which doesn't override one of the three hooks above still gets that hook's
already-permissive default (an empty/no-op override) for free, instead of every subclass
having to restate "permit everything" explicitly.
-
Field Summary
Fields inherited from class org.smtlib.impl.SMTExpr.Logic
attributes, attributesList, logicName, smtConfigFields inherited from class org.smtlib.impl.Pos.Posable
pos -
Constructor Summary
ConstructorsConstructorDescriptionLogic(SMT.Configuration smtConfig, IExpr.ISymbol name, Collection<IExpr.IAttribute<?>> attributes) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanWhether this logic allows the Array sort array, whose own sort is already expanded and which contains no sort parameterprotected StringThe Array sorts this logic allows, as text for error messages, or null if it allows every Array sort.protected voidcheckArraySorts(List<ISort> argSorts, ISort resultSort, IExpr.IIdentifier id) Checks the Array sorts in a function's argument and result sortsprotected voidcheckArraySorts(ISort sort, IPos pos) Checks every Array sort within sort, expanding abbreviations, againstallowedArraySort(org.smtlib.ISort.IApplication).protected voidcheckBoundArraySorts(IExpr expression) Checks the Array sorts of the variables bound by quantifiers in expressionprotected static booleanisBitVecArray(ISort.IApplication array) Whether array is (Array (_ BitVec i) (_ BitVec j)), as QF_ABV and QF_AUFBV requireprotected static booleanisBitVecSort(ISort sort) Whether sort, with abbreviations expanded, is a (_ BitVec n) sortbooleanisFreeConstant(IExpr expr) booleanbooleanisLinearInteger(IExpr expr) booleanisLinearReal(IExpr expr) booleanisRealConst(IExpr expr) voidnoExponentiation(IExpr expression) voidnoFunctions(IExpr.IIdentifier id, List<ISort> argSorts, ISort resultSort, IExpr definition) nonCoefficients(IExpr.IFcnExpr e, Predicate<IExpr> isCoefficient) The arguments of an application (of * or /) that are not coefficients.voidnoQuantifiers(IExpr expression) voidnoSorts(IExpr.IIdentifier id, List<ISort.IParameter> params, ISort expr) protected IVisitor.VisitorExceptionrestrictionError(String message, IExpr e) Builds a VisitorException for a restriction violation (e.g.protected static booleanWhether sort, with abbreviations expanded, is structurally the same as allowedprotected ISortCreates the sort expressionname(params...), e.g.Methods inherited from class org.smtlib.impl.SMTExpr.Logic
accept, attributeList, attributes, checkFcnDeclaration, checkSortDeclaration, logicName, validExpression, valueMethods inherited from class org.smtlib.impl.Pos.Printable
toStringMethods inherited from class org.smtlib.impl.Pos.Posable
equals, hashCode, pos, setPosMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.smtlib.ILanguage
checkFcnDeclaration, checkSortDeclaration, validExpression
-
Constructor Details
-
Logic
public Logic(SMT.Configuration smtConfig, IExpr.ISymbol name, Collection<IExpr.IAttribute<?>> attributes)
-
-
Method Details
-
noQuantifiers
- Throws:
IVisitor.VisitorException
-
noExponentiation
- Throws:
IVisitor.VisitorException
-
noFunctions
public void noFunctions(IExpr.IIdentifier id, List<ISort> argSorts, ISort resultSort, IExpr definition) throws IVisitor.VisitorException - Throws:
IVisitor.VisitorException
-
noSorts
public void noSorts(IExpr.IIdentifier id, List<ISort.IParameter> params, ISort expr) throws IVisitor.VisitorException - Throws:
IVisitor.VisitorException
-
restrictionError
Builds a VisitorException for a restriction violation (e.g. QF_IDL/QF_RDL's difference-logic shape, LRA's linearity check) whose message includes the offending expression's own printed text, not just an abstract description of the rule it broke -- several subclasses' checks used to throw the bare message alone, each with its own "// FIXME" noting the expression text was meant to be included but wasn't. -
sortApp
Creates the sort expressionname(params...), e.g.sortApp("Array", intSort, intSort)for(Array Int Int). Used to build canonical sorts for structural comparison (viaISort.equalsNoExpand(org.smtlib.ISort)), rather than comparing printed text. -
allowedArraySorts
The Array sorts this logic allows, as text for error messages, or null if it allows every Array sort. A logic restricting Array sorts overrides this andallowedArraySort(org.smtlib.ISort.IApplication). -
allowedArraySort
Whether this logic allows the Array sort array, whose own sort is already expanded and which contains no sort parameter -
checkArraySorts
Checks every Array sort within sort, expanding abbreviations, againstallowedArraySort(org.smtlib.ISort.IApplication). An Array sort containing a sort parameter is skipped: it is checked where the parameterized abbreviation is instantiated.- Throws:
IVisitor.VisitorException
-
checkArraySorts
protected void checkArraySorts(List<ISort> argSorts, ISort resultSort, IExpr.IIdentifier id) throws IVisitor.VisitorException Checks the Array sorts in a function's argument and result sorts- Throws:
IVisitor.VisitorException
-
checkBoundArraySorts
Checks the Array sorts of the variables bound by quantifiers in expression- Throws:
IVisitor.VisitorException
-
sameSort
Whether sort, with abbreviations expanded, is structurally the same as allowed -
isBitVecArray
Whether array is (Array (_ BitVec i) (_ BitVec j)), as QF_ABV and QF_AUFBV require -
isBitVecSort
Whether sort, with abbreviations expanded, is a (_ BitVec n) sort -
isInteger
-
isFreeConstant
-
nonCoefficients
The arguments of an application (of * or /) that are not coefficients. A product, of any arity, is linear when at most one of its factors is not a coefficient. -
isLinearInteger
-
isLinearReal
-
isRealConst
-