Package net.maswag.falcaun.verification
Class NumericSULVerifier
java.lang.Object
net.maswag.falcaun.verification.NumericSULVerifier
- All Implemented Interfaces:
AutoCloseable
Verifies a Numeric System Under Learning (NumericSUL) against specified properties using various equivalence oracles and model checking techniques.
This class provides a framework for verifying the behavior of a numeric system under learning by comparing it against a set of Signal Temporal Logic (STL) properties. It uses learning algorithms, equivalence oracles, and model checkers to identify any discrepancies between the expected and actual behaviors.
- Author:
- Masaki Waga <masakiwaga@gmail.com>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EvaluationCountable.Sumprivate final NumericMembershipOracleprivate final SignalDiscretizerprivate final doubleprotected final NumericSULprivate final BlackBoxVerifier<List<Double>> -
Constructor Summary
ConstructorsConstructorDescriptionNumericSULVerifier(NumericSUL sul, double signalStep, AdaptiveSTLUpdater<List<Double>> properties, SignalDiscretizer signalDiscretizer) Constructor for NumericSULVerifier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBFOracle(double multiplier) voidaddCompleteExplorationEQOracle(int minDepth, int maxDepth, int batchSize) voidaddCornerCaseEQOracle(int length, int minStep) Add a corner case equivalence oracle.voidaddGAEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, int maxTests, GASelectionKind selectionKind, int generationSize, double crossoverProb, double mutationProbability, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) add a Genetic algorithm-based equivalence oraclevoidaddGAEQOracleAll(int length, int maxTest, GASelectionKind selectionKind, int populationSize, double crossoverProb, double mutationProb) voidaddHillClimbingEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) addHillClimbingEQOracle.voidaddHillClimbingEQOracle(TemporalLogic.STLCost costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) voidaddHillClimbingEQOracleAll(int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) (package private) voidaddMutateSelectEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, int changeSize, boolean resetWord) voidaddRandomWalkEQOracle(double restartProbability, long maxSteps, Random random) voidaddRandomWordEQOracle(int minLength, int maxLength, int maxTests, Random random, int batchSize) (package private) voidaddRobustnessEqOracle(Function<IOSignal<List<Double>>, Double> costFunc, Function<RobustnessOracle, ? extends EvaluationCountable.MealyEquivalenceOracle<String, String>> constructor) Add an equivalence oracle guided by the robustness of the given cost function.voidaddSAEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, double alpha, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) addSAEQOracle.voidaddSAEQOracleAll(int length, Random random, int maxTest, int generationSize, int childrenSize, boolean resetWord, double alpha) voidaddWpMethodEQOracle(int maxDepth) voidclose()Close the SUL, e.g., the MATLAB engine or the Python interpreter.Returns the concrete input signal of a counterexample.intReturns the number of the evaluations of input words by the equivalence oracles.doubleintrun()Run black-box checking.voidsetTimeout(long timeout) Set timeout to the equivalence oracle added next time.voidVisualize the Mealy machine witnessing a counterexample.voidVisualize the learned Mealy machinevoidWirte the DOT of the Mealy machine witnessing a counterexample.voidWirte the DOT of the learned Mealy machinevoidWrite the ETF of the learned Mealy machine.
-
Field Details
-
sul
-
signalDiscretizer
-
verifier
-
memOracle
-
evaluationCountables
-
signalStep
private final double signalStep
-
-
Constructor Details
-
NumericSULVerifier
public NumericSULVerifier(NumericSUL sul, double signalStep, AdaptiveSTLUpdater<List<Double>> properties, SignalDiscretizer signalDiscretizer) Constructor for NumericSULVerifier.
- Parameters:
sul- The system under test.signalStep- The signal step in the simulationproperties- The LTL properties to be verifiedsignalDiscretizer- The I/O mapper between the abstract and concrete signals.
-
-
Method Details
-
addRobustnessEqOracle
void addRobustnessEqOracle(Function<IOSignal<List<Double>>, Double> costFunc, Function<RobustnessOracle, ? extends EvaluationCountable.MealyEquivalenceOracle<String, String>> constructor) Add an equivalence oracle guided by the robustness of the given cost function. The SUL executions and their caches are shared with the membership oracle. -
addWpMethodEQOracle
public void addWpMethodEQOracle(int maxDepth) -
addBFOracle
public void addBFOracle(double multiplier) -
addRandomWordEQOracle
public void addRandomWordEQOracle(int minLength, int maxLength, int maxTests, Random random, int batchSize) -
addRandomWalkEQOracle
-
addCompleteExplorationEQOracle
public void addCompleteExplorationEQOracle(int minDepth, int maxDepth, int batchSize) -
addCornerCaseEQOracle
public void addCornerCaseEQOracle(int length, int minStep) Add a corner case equivalence oracle.This oracle tries the corner case input, i.e., the inputs with the same values
- Parameters:
length- The length of the input.minStep- The minimum step of the corner case.
-
setTimeout
public void setTimeout(long timeout) Set timeout to the equivalence oracle added next time.- Parameters:
timeout- timeout in seconds.
-
addHillClimbingEQOracle
public void addHillClimbingEQOracle(TemporalLogic.STLCost costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) -
addHillClimbingEQOracle
public void addHillClimbingEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) addHillClimbingEQOracle.
- Parameters:
costFunc- aFunctionobject.length- a int.random- aRandomobject.maxTests- a int.generationSize- a int.childrenSize- a int.resetWord- a boolean.ltlOracle- aPropertyOracle.MealyPropertyOracleobject.
-
addHillClimbingEQOracleAll
public void addHillClimbingEQOracleAll(int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord) -
addSAEQOracle
public void addSAEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, Random random, int maxTests, int generationSize, int childrenSize, boolean resetWord, double alpha, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) addSAEQOracle.
- Parameters:
costFunc- aFunctionobject.length- a int.random- aRandomobject.maxTests- a int.generationSize- a int.childrenSize- a int.resetWord- a boolean.alpha- a double.ltlOracle- aPropertyOracle.MealyPropertyOracleobject.
-
addMutateSelectEQOracle
-
addGAEQOracle
public void addGAEQOracle(Function<IOSignal<List<Double>>, Double> costFunc, int length, int maxTests, GASelectionKind selectionKind, int generationSize, double crossoverProb, double mutationProbability, PropertyOracle.MealyPropertyOracle<String, String, String> ltlOracle) add a Genetic algorithm-based equivalence oracle- Parameters:
costFunc- The cost function assigning a Double to each OutputSignal. This is typically an STL formula.length- length of the generated signalsmaxTests- maximum test sizeselectionKind- kind of the selection methodgenerationSize- size of each generation. This must be an even number.crossoverProb- probability to have crossovermutationProbability- probability to have mutationltlOracle- the LTL formula
-
concreteInput
Returns the concrete input signal of a counterexample.- Parameters:
cex- a counterexample in the result ofrun()- Returns:
- the concrete input signal constructed from the abstract input of
cex
-
run
Run black-box checking.- Returns:
- the result of black-box checking including the statistics of the SUL executions
- See Also:
-
writeDOTCex
Wirte the DOT of the Mealy machine witnessing a counterexample.- Parameters:
cex- a counterexample in the result ofrun()a- Write the DOT toa- Throws:
IOException- The exception by GraphDOT.write
-
writeDOTLearnedMealy
Wirte the DOT of the learned Mealy machine- Parameters:
a- Write the DOT toa- Throws:
IOException- The exception by GraphDOT.write
-
writeETFLearnedMealy
Write the ETF of the learned Mealy machine.- Parameters:
os- Write the ETF toos
-
visualizeCex
Visualize the Mealy machine witnessing a counterexample.- Parameters:
cex- a counterexample in the result ofrun()
-
visualizeLearnedMealy
public void visualizeLearnedMealy()Visualize the learned Mealy machine -
getSutExecutionCount
public int getSutExecutionCount()- Returns:
- the number of the executions of the SUL
-
getEqEvaluationCount
public int getEqEvaluationCount()Returns the number of the evaluations of input words by the equivalence oracles.This is not necessarily the number of the SUL executions by the equivalence oracles. For example, the corner-case equivalence oracle counts every evaluated word, including the ones answered by a cache, while the robustness-based equivalence oracles count only the actual executions.
- Returns:
- the number of the evaluations of input words by the equivalence oracles
-
getProperties
- Returns:
- Signal Temporal Logic (STL) properties to be verified
-
addSAEQOracleAll
public void addSAEQOracleAll(int length, Random random, int maxTest, int generationSize, int childrenSize, boolean resetWord, double alpha) -
addGAEQOracleAll
public void addGAEQOracleAll(int length, int maxTest, GASelectionKind selectionKind, int populationSize, double crossoverProb, double mutationProb) -
close
Close the SUL, e.g., the MATLAB engine or the Python interpreter.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getSimulationTimeSecond
public double getSimulationTimeSecond()- Returns:
- the execution time for the simulations
-