haal-0.5.0.0: A Haskell library for Active Automata Learning.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Haal.Experiment

Description

This module exports the basic types, classes and functions that are required to easily construct and configure learning experiments.

Synopsis

Documentation

type Experiment sul result = ExperimentT sul Identity result Source #

The Experiment type is a type alias for the ExperimentT type with the Identity monad. This allows for running pure experiments.

type ExperimentT sul (m :: Type -> Type) result = ReaderT sul m result Source #

The ExperimentT type is a monad transformer that allows for running experiments in a reader monad. This may prove useful for learning real systems, which requires IO.

class Learner (l :: Type -> Type -> Type) (aut :: Type -> Type -> Type -> Type) s | l -> aut s where Source #

The Learner type class defines the interface for learning algorithms. Instances of this class should provide methods to initialize the learner, refine the learner with a counterexample, and learn an automaton. The type l determines the type of automaton aut that is learned.

Methods

initialize :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> ExperimentT (sul i o) m (l i o) Source #

refine :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => l i o -> [i] -> ExperimentT (sul i o) m (l i o) Source #

learn :: forall sul (m :: Type -> Type) i o. (SUL sul m, Automaton aut s, FiniteOrd i, FiniteOrd s, FiniteOrd o) => l i o -> ExperimentT (sul i o) m (l i o, aut s i o) Source #

Instances

Instances details
Learner LMstar MealyAutomaton StateID Source # 
Instance details

Defined in Haal.Learning.LMstar

Methods

initialize :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => LMstar i o -> ExperimentT (sul i o) m (LMstar i o) Source #

refine :: forall sul (m :: Type -> Type) i o. (SUL sul m, FiniteOrd i, Finite o) => LMstar i o -> [i] -> ExperimentT (sul i o) m (LMstar i o) Source #

learn :: forall sul (m :: Type -> Type) i o. (SUL sul m, Automaton MealyAutomaton StateID, FiniteOrd i, FiniteOrd StateID, FiniteOrd o) => LMstar i o -> ExperimentT (sul i o) m (LMstar i o, MealyAutomaton StateID i o) Source #

class EquivalenceOracle or where Source #

The EquivalenceOracle type class defines the interface for equivalence oracles. Instances of this class should provide methods to generate a test suite

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => or -> aut s i o -> (or, [[i]]) Source #

Instances

Instances details
EquivalenceOracle RandomWalk Source # 
Instance details

Defined in Haal.EquivalenceOracle.RandomWalk

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => RandomWalk -> aut s i o -> (RandomWalk, [[i]]) Source #

EquivalenceOracle RandomWords Source # 
Instance details

Defined in Haal.EquivalenceOracle.RandomWords

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => RandomWords -> aut s i o -> (RandomWords, [[i]]) Source #

EquivalenceOracle RandomWMethod Source # 
Instance details

Defined in Haal.EquivalenceOracle.WMethod

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => RandomWMethod -> aut s i o -> (RandomWMethod, [[i]]) Source #

EquivalenceOracle WMethod Source # 
Instance details

Defined in Haal.EquivalenceOracle.WMethod

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => WMethod -> aut s i o -> (WMethod, [[i]]) Source #

EquivalenceOracle RandomWpMethod Source # 
Instance details

Defined in Haal.EquivalenceOracle.WpMethod

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => RandomWpMethod -> aut s i o -> (RandomWpMethod, [[i]]) Source #

EquivalenceOracle WpMethod Source # 
Instance details

Defined in Haal.EquivalenceOracle.WpMethod

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => WpMethod -> aut s i o -> (WpMethod, [[i]]) Source #

(EquivalenceOracle a, EquivalenceOracle b) => EquivalenceOracle (CombinedOracle a b) Source # 
Instance details

Defined in Haal.EquivalenceOracle.CombinedOracle

Methods

testSuite :: (Automaton aut s, FiniteOrd i, FiniteOrd s, Eq o) => CombinedOracle a b -> aut s i o -> (CombinedOracle a b, [[i]]) Source #

data Statistics (aut :: Type -> Type -> Type -> Type) s i o Source #

The Statistics data type is parameterized by the type of model being learned and the state, input and output types of the model. Its purpose is to keep track of different experimental stats. For the time being, only the number of rounds statsRounds, the counterexamples statsCexs and the intermediate hypotheses statsHyps are being kept track of.

Constructors

Statistics 

Fields

Instances

Instances details
(Show i, Show (aut s i o)) => Show (Statistics aut s i o) Source # 
Instance details

Defined in Haal.Experiment

Methods

showsPrec :: Int -> Statistics aut s i o -> ShowS #

show :: Statistics aut s i o -> String #

showList :: [Statistics aut s i o] -> ShowS #

experiment :: forall sul (m :: Type -> Type) aut s learner oracle i o. (SUL sul m, Automaton aut s, Learner learner aut s, EquivalenceOracle oracle, FiniteOrd i, FiniteOrd s, FiniteOrd o) => learner i o -> oracle -> ExperimentT (sul i o) m (aut s i o, Statistics aut s i o) Source #

The experiment function returns an Experiment that can be run with the runExperiment function. It takes a learner and an equivalence oracle and then requires a system under learning (SUL) to run the experiment.

runExperiment :: Reader r a -> r -> a Source #

The runExperiment function runs an experiment in the Experiment monad. It is just an alias for runReader.

pairwiseWalk :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [i] -> m Bool Source #

The pairwiseWalk function executes a test case on both the SUL and the automaton simultaneously, checking if the outputs are the same.

execute :: (SUL sul m, Automaton aut s, Ord i, Eq o) => sul i o -> aut s i o -> [[i]] -> m ([i], [o]) Source #

The execute function executes the test suite of an oracle, given a SUL and an automaton.

findCex :: forall sul (m :: Type -> Type) aut s or i o. (SUL sul m, Automaton aut s, EquivalenceOracle or, FiniteOrd i, FiniteOrd s, Eq o) => or -> aut s i o -> ExperimentT (sul i o) m (or, ([i], [o])) Source #

The findCex function executes the test suite of each oracle to the automaton and SUL.

runExperimentT :: ReaderT r m a -> r -> m a Source #

The runExperimentT function runs an experiment in the ExperimentT monad. It is just an alias for runReaderT.