Class BlackBoxVerifier<I>

java.lang.Object
net.maswag.falcaun.verification.BlackBoxVerifier<I>
Type Parameters:
I - The type of input symbols at each step.

public class BlackBoxVerifier<I> extends Object
Verifies a black-box system against specified properties using various equivalence oracles and model checking techniques.

This class provides a comprehensive framework for verifying the behavior of a black-box system by comparing it against a set of Signal Temporal Logic (STL) properties. It utilizes learning algorithms, equivalence oracles, and model checkers to identify any discrepancies between the expected and actual behaviors of the system.

Author:
Masaki Waga <masakiwaga@gmail.com>
See Also:
  • Field Details

    • EDGE_PARSER

      private static final Function<String,String> EDGE_PARSER
    • memOracle

      The membership oracle used to evaluate test cases and provide the system's output for given inputs.
    • verifiedSystem

      private final SUL<String,String> verifiedSystem
      The System Under Learning (SUL) representing the black-box system to be verified.
    • learnedMealy

      private net.automatalib.automaton.transducer.MealyMachine<?,String,?,String> learnedMealy
      The learned Mealy machine that models the behavior of the black-box system based on test cases.
    • inputAlphabet

      private final net.automatalib.alphabet.Alphabet<String> inputAlphabet
      The alphabet of input symbols used in the verification process.
    • learner

      The learning algorithm used to learn the behavior of the black-box system from test cases.
    • eqOracle

      private final MealyEQOracleChain<String,String> eqOracle
      The equivalence oracle used to find counterexamples by comparing the learned model with the black-box system.
    • properties

      private final AdaptiveSTLUpdater<I> properties
      The adaptive STL updater that manages and updates the Signal Temporal Logic (STL) properties to be verified.
    • modelChecker

      private final net.automatalib.modelchecking.ModelChecker.MealyModelChecker<String,String,String,net.automatalib.automaton.transducer.MealyMachine<?,String,?,String>> modelChecker
      The model checker used to verify the learned Mealy machine against Signal Temporal Logic (STL) properties.
    • timeoutOracles

      private final List<TimeoutEQOracle<String,String>> timeoutOracles
      A list of timeout oracles used to manage timeouts for equivalence oracle operations.
    • timeout

      private Long timeout
      The timeout value in seconds used for equivalence oracle operations.
  • Constructor Details

  • Method Details

    • 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

      public void addRandomWalkEQOracle(double restartProbability, long maxSteps, Random random)
    • addCompleteExplorationEQOracle

      public void addCompleteExplorationEQOracle(int minDepth, int maxDepth, int batchSize)
    • addCornerCaseEQOracle

      public EvaluationCountable.MealyEquivalenceOracle<String,String> 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.
    • addEqOracle

      public void addEqOracle(EquivalenceOracle.MealyEquivalenceOracle<String,String> eqOracle)
    • setTimeout

      public void setTimeout(long timeout)
      Set timeout to the equivalence oracle added next time.
      Parameters:
      timeout - timeout in seconds.
    • run

      public VerificationResult<I> run()
      Run black-box checking.

      The equivalence oracles are tried in the order of their addition until a counterexample is found, all the target specifications are falsified, or all the equivalence oracles are exhausted. Then, the counterexamples are extracted from the final learned Mealy machine and validated by the SUL. A failure of the SUL execution is reported as VerificationResult.TerminationReason.EXECUTION_FAILURE instead of an exception. If the failure happens while validating the counterexamples, the counterexamples validated before the failure are still reported.

      Returns:
      the result of black-box checking
    • writeDOTCex

      public void writeDOTCex(VerificationResult.Counterexample<?> cex, Appendable a) throws IOException
      Wirte the DOT of the Mealy machine witnessing a counterexample.
      Parameters:
      cex - The counterexample
      a - Write the DOT to a
      Throws:
      IOException - The exception by GraphDOT.write
    • writeDOTLearnedMealy

      public void writeDOTLearnedMealy(Appendable a) throws IOException
      Wirte the DOT of the learned Mealy machine.
      Parameters:
      a - Write the DOT to a
      Throws:
      IOException - The exception by GraphDOT.write
    • visualizeCex

      public void visualizeCex(VerificationResult.Counterexample<?> cex)
      Visualize the Mealy machine witnessing a counterexample.
    • visualizeLearnedMealy

      public void visualizeLearnedMealy()
      Visualize the learned Mealy machine
    • writeETFLearnedMealy

      public void writeETFLearnedMealy(OutputStream os)
      Write the ETF of the learned Mealy machine.
      Parameters:
      os - Write the ETF to os
    • processMealy

      private VerificationResult<I> processMealy(int rounds)
      Extract the counterexamples from the learned Mealy machine and validate them by the SUL.
      Parameters:
      rounds - the number of the learning rounds
      Returns:
      the result of black-box checking
    • violates

      private boolean violates(String ltlProperty, net.automatalib.word.Word<String> input, net.automatalib.word.Word<String> output)
      Checks if an observed trace violates an LTL formula.

      We check the formula by the same model checker as the learned Mealy machine. The Mealy machine given to the model checker has only the observed trace, so the semantics is the same as the check of the learned Mealy machine restricted to this trace.

      Parameters:
      ltlProperty - the LTL formula
      input - the input word of the trace
      output - the output word of the trace
      Returns:
      true if and only if the trace violates ltlProperty
    • rounds

      private static int rounds(MealyExperiment<String,String> experiment)
      Returns the number of the learning rounds of an experiment recorded by LearnLib's statistics service. The experiment records the rounds with itself as the owner, also before a failure of the learning.