Class CommonSymbolicUniverse
java.lang.Object
edu.udel.cis.vsl.sarl.preuniverse.common.CommonPreUniverse
edu.udel.cis.vsl.sarl.universe.common.CommonSymbolicUniverse
- All Implemented Interfaces:
CoreUniverse,SymbolicUniverse,PreUniverse
- Direct Known Subclasses:
MathUniverse
A standard implementation of
SymbolicUniverse, relying heavily on a
given NumericExpressionFactory for dealing with numeric issues and a
BooleanExpressionFactory for dealing with boolean expressions.-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.udel.cis.vsl.sarl.IF.CoreUniverse
CoreUniverse.ForallStructure -
Field Summary
Fields inherited from class edu.udel.cis.vsl.sarl.preuniverse.common.CommonPreUniverse
DENSE_ARRAY_MAX_SIZE, QUANTIFIER_EXPAND_BOUND -
Constructor Summary
ConstructorsConstructorDescriptionCommonSymbolicUniverse(FactorySystem system) Constructs a new CommonSymbolicUniverse from the given system of factories. -
Method Summary
Modifier and TypeMethodDescriptionvoidenableSARLTestGeneration(boolean enable) Enable SARL test generation.extractNumber(BooleanExpression assumption, NumericExpression expression) Attempts to extract a concrete numeric value from the given expression, using the assumption if necessary to simplify the expression.voidgenerateTestClass(String name) pre-conditionSymbolicUniverse.enableSARLTestGeneration(boolean)has been set to truereasoner(BooleanExpression context) Returns aReasonerfor the given context.voidsaveValidCallAsSARLTest(BooleanExpression context, BooleanExpression predicate, ValidityResult.ResultType expectedResult, boolean useWhy3, String testName, String... comments) pre-conditionSymbolicUniverse.enableSARLTestGeneration(boolean)has been set to truevoidsetLogicFunctions(ProverFunctionInterpretation[] logicFunctions) Set a list of logic functions with their definitions to the universe so thatReasoners created by this universe can take use of the definitions of the given logic functions.voidsetReasonerFactory(ReasonerFactory reasonerFactory) voidsetWhy3ReasonerFactory(Why3ReasonerFactory reasonerFactory) why3Reasoner(BooleanExpression context) Same as#reasoner(BooleanExpression, boolean)but only Why3 prove platform will be used if it is installed.Methods inherited from class edu.udel.cis.vsl.sarl.preuniverse.common.CommonPreUniverse
add, add, and, and, append, apply, array, array, arrayDimensionAndBaseType, arrayElementReference, arrayLambda, arrayRead, arrayType, arrayType, arrayWrite, assign, bitand, bitnot, bitor, bitshiftLeft, bitshiftRight, bitvector2Integer, bitVectorType, bitxor, bool, bool, booleanObject, booleanType, boundedIntegerType, canonicalRenamer, canonicalRenamer, cardinality, cast, ceil, character, characterType, charObject, cleanBoundVariables, cloneBoundCleaner, comparator, compatible, concreteValueOfUninterpretedType, cond, constantArray, denseArrayWrite, denseTupleWrite, dereference, derivative, differentiable, divide, divides, emptyArray, emptyMap, entrySet, entryType, equals, equiv, exists, existsInt, expand, extractBoolean, extractCharacter, extractNumber, falseExpression, floor, forall, forallInt, fullySubstitute, functionType, functionType, get, getErrFile, getForallStructure, getFreeSymbolicConstants, getIntegerLengthBound, getOutputStream, getProbabilisticBound, getShowProverQueries, getShowQueries, getSummands, getUseBackwardSubstitution, herbrandIntegerType, herbrandRealType, identityReference, implies, incrementProverValidCount, incrementValidCount, insertElementAt, integer, integer, integer, integer2Bitvector, integerType, intObject, isPermutCall, isSigmaCall, isSubsetOf, keySet, lambda, length, lessThan, lessThanEquals, make, mapSize, mapSubstituter, mapType, minus, modulo, multiply, multiply, nameSubstituter, neq, newMinimalBoundCleaner, not, nullExpression, nullReference, number, number, numberFactory, numberObject, numericExpressionFactory, numObjects, numProverValidCalls, numValidCalls, objectFactory, objectWithId, offsetReference, oneInt, oneReal, or, or, permut, power, power, power, printCompressed, printCompressedTree, printExprTree, pureType, put, rational, rational, rational, rational, rational, rational, rational, rational, realType, reduction, referencedType, referenceType, removeElementAt, removeEntryWithKey, roundToZero, setAdd, setDifference, setErrFile, setIntegerLengthBound, setIntersection, setOutputStream, setProbabilisticBound, setRemove, setShowProverQueries, setShowQueries, setType, setUnion, setUseBackwardSubstitution, sigma, simpleSubstituter, stringExpression, stringObject, subtract, symbolicConstant, symbolicUninterpretedType, trueExpression, tuple, tuple, tupleComponentReference, tupleRead, tupleType, tupleType, tupleWrite, typeFactory, typeSequence, typeSequence, unionExtract, unionInject, unionMemberReference, unionTest, unionType, unionType, valueSetAssigns, valueSetContains, valueSetNoIntersect, valueSetReferences, valueSetReferenceType, valueSetTemplate, valueSetTemplateType, valueSetUnion, valueSetWidening, valueType, vsArrayElementReference, vsArraySectionReference, vsArraySectionReference, vsIdentityReference, vsOffsetReference, vsTupleComponentReference, vsUnionMemberReference, zeroInt, zeroRealMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.udel.cis.vsl.sarl.IF.CoreUniverse
add, add, and, and, append, apply, array, array, arrayDimensionAndBaseType, arrayElementReference, arrayLambda, arrayRead, arrayType, arrayType, arrayWrite, assign, bitand, bitnot, bitor, bitshiftLeft, bitshiftRight, bitvector2Integer, bitVectorType, bitxor, bool, bool, booleanObject, booleanType, boundedIntegerType, canonicalRenamer, canonicalRenamer, cardinality, cast, ceil, character, characterType, comparator, compatible, concreteValueOfUninterpretedType, cond, constantArray, denseArrayWrite, dereference, derivative, differentiable, divide, divides, emptyArray, emptyMap, entrySet, entryType, equals, equiv, exists, existsInt, expand, extractBoolean, extractCharacter, extractNumber, falseExpression, floor, forall, forallInt, fullySubstitute, functionType, get, getErrFile, getForallStructure, getFreeSymbolicConstants, getIntegerLengthBound, getOutputStream, getProbabilisticBound, getShowProverQueries, getShowQueries, getSummands, getUseBackwardSubstitution, herbrandIntegerType, herbrandRealType, identityReference, implies, insertElementAt, integer, integer, integer, integer2Bitvector, integerType, intObject, isPermutCall, isSigmaCall, isSubsetOf, keySet, lambda, length, lessThan, lessThanEquals, make, mapSize, mapSubstituter, mapType, minus, modulo, multiply, multiply, nameSubstituter, neq, not, nullExpression, nullReference, number, number, numberFactory, numberObject, numObjects, numProverValidCalls, numValidCalls, objectWithId, offsetReference, oneInt, oneReal, or, or, permut, power, power, power, printCompressed, printCompressedTree, printExprTree, pureType, put, rational, rational, rational, rational, rational, rational, rational, rational, realType, reduction, referencedType, referenceType, removeElementAt, removeEntryWithKey, roundToZero, setAdd, setDifference, setErrFile, setIntegerLengthBound, setIntersection, setOutputStream, setProbabilisticBound, setRemove, setShowProverQueries, setShowQueries, setType, setUnion, setUseBackwardSubstitution, sigma, simpleSubstituter, stringExpression, stringObject, subtract, symbolicConstant, symbolicUninterpretedType, trueExpression, tuple, tuple, tupleComponentReference, tupleRead, tupleType, tupleWrite, unionExtract, unionInject, unionMemberReference, unionTest, unionType, valueSetAssigns, valueSetContains, valueSetNoIntersect, valueSetReferences, valueSetReferenceType, valueSetTemplate, valueSetTemplateType, valueSetUnion, valueSetWidening, valueType, vsArrayElementReference, vsArraySectionReference, vsArraySectionReference, vsIdentityReference, vsOffsetReference, vsTupleComponentReference, vsUnionMemberReference, zeroInt, zeroReal
-
Constructor Details
-
CommonSymbolicUniverse
Constructs a new CommonSymbolicUniverse from the given system of factories.- Parameters:
system- a factory system
-
-
Method Details
-
reasoner
Description copied from interface:SymbolicUniverseReturns aReasonerfor the given context. AReasonerprovides simplification and reasoning services. The context is the boolean expression assumed to hold by the reasoner. The Reasoner can be used to determine if a boolean predicate is valid; it may use an external theorem prover to assist in this task.- Specified by:
reasonerin interfaceSymbolicUniverse- Parameters:
context- the boolean expression assumed to hold by theReasoner- Returns:
- a
Reasonerwith the given context
-
setReasonerFactory
-
extractNumber
Description copied from interface:SymbolicUniverseAttempts to extract a concrete numeric value from the given expression, using the assumption if necessary to simplify the expression. For example, if the assumption is "N=5" and the expression is "N", this method will probably return the number 5. If it cannot obtain a concrete value for whatever reason, it will return null.- Specified by:
extractNumberin interfaceSymbolicUniverse- Parameters:
assumption- a boolean expression that is assumed to holdexpression- a symbolic expression of numeric type- Returns:
- a concrete Number or null
-
why3Reasoner
Description copied from interface:SymbolicUniverseSame as#reasoner(BooleanExpression, boolean)but only Why3 prove platform will be used if it is installed. If Why3 is not installed, this function is equivalent to#reasoner(BooleanExpression, boolean)- Specified by:
why3Reasonerin interfaceSymbolicUniverse- Parameters:
context- a non-nullboolean expression to be used as the context for theReasoner- Returns:
- a
Reasonerbased on the givencontext
-
setWhy3ReasonerFactory
-
enableSARLTestGeneration
public void enableSARLTestGeneration(boolean enable) Description copied from interface:SymbolicUniverseEnable SARL test generation. Once it is enabled, clients can call#saveValidCallAsSARLTest(BooleanExpression, BooleanExpression, ProverFunctionInterpretation[], ResultType, String[])to add new tests and callSymbolicUniverse.generateTestClass(String)to generate Junit test class file.- Specified by:
enableSARLTestGenerationin interfaceSymbolicUniverse- Parameters:
enable- true to enable SARL test generation; otherwise, disable SARL test generation
-
saveValidCallAsSARLTest
public void saveValidCallAsSARLTest(BooleanExpression context, BooleanExpression predicate, ValidityResult.ResultType expectedResult, boolean useWhy3, String testName, String... comments) Description copied from interface:SymbolicUniversepre-condition
SymbolicUniverse.enableSARLTestGeneration(boolean)has been set to trueSaving a query as a SARL's Junit test. No-op if pre-condition is not satisified.
- Specified by:
saveValidCallAsSARLTestin interfaceSymbolicUniverse- Parameters:
context- a non-nullboolean expression to be used as the context for theReasonerpredicate- a non-nullboolean expression which is the asserted predicate of the saving queryexpectedResult- the expectedValidityResult.ResultTypeof this query. If the test gets a result that is same as the expectedResult, the test passes, otherwise the test fails.useWhy3- if this valid call must be proved by why3testName- name of this saving testcomments- Variable number of arguments for Java comments over the generated query. One comment block per argument.
-
generateTestClass
Description copied from interface:SymbolicUniversepre-condition
Flush all saved SARLTests to a java class. No-op if pre-condition is not satisified.SymbolicUniverse.enableSARLTestGeneration(boolean)has been set to true- Specified by:
generateTestClassin interfaceSymbolicUniverse- Parameters:
name- the name of the generated class
-
setLogicFunctions
Description copied from interface:SymbolicUniverseSet a list of logic functions with their definitions to the universe so that
Reasoners created by this universe can take use of the definitions of the given logic functions.Logic functions are instances of
ProverFunctionInterpretations- Specified by:
setLogicFunctionsin interfaceSymbolicUniverse- Parameters:
logicFunctions- an array ofProverFunctionInterpretations
-