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

Haal.BlackBox

Description

This module defines the BlackBox type class as well as the Automaton and SUL sub classes.

Synopsis

Documentation

class SUL (aut s) Identity => Automaton (aut :: Type -> Type -> Type -> Type) s where Source #

The Automaton type class extends the SUL type class and adds support for automata operations. Automatons are models, not programs, so they are pure and operate in the Identity monad.

Methods

transitions :: (FiniteOrd i, FiniteOrd s) => aut s i o -> Map (s, i) (s, o) Source #

states :: FiniteOrd s => aut s i o -> Set s Source #

current :: aut s i o -> s Source #

update :: aut s i o -> s -> aut s i o Source #

Instances

Instances details
Automaton MealyAutomaton s Source # 
Instance details

Defined in Haal.Automaton.MealyAutomaton

Methods

transitions :: (FiniteOrd i, FiniteOrd s) => MealyAutomaton s i o -> Map (s, i) (s, o) Source #

states :: FiniteOrd s => MealyAutomaton s i o -> Set s Source #

current :: MealyAutomaton s i o -> s Source #

update :: MealyAutomaton s i o -> s -> MealyAutomaton s i o Source #

Automaton MooreAutomaton s Source # 
Instance details

Defined in Haal.Automaton.MooreAutomaton

Methods

transitions :: (FiniteOrd i, FiniteOrd s) => MooreAutomaton s i o -> Map (s, i) (s, o) Source #

states :: FiniteOrd s => MooreAutomaton s i o -> Set s Source #

current :: MooreAutomaton s i o -> s Source #

update :: MooreAutomaton s i o -> s -> MooreAutomaton s i o Source #

class Monad m => SUL (sul :: Type -> Type -> Type) (m :: Type -> Type) where Source #

The SUL type class defines the basic interface for a black box automaton. It provides methods to step through the automaton and retrieve the current state. It also requires a monad m, that may be Identity in case of a pure SUL, or IO in case of an external program that performs IO.

Methods

step :: sul i o -> i -> m (sul i o, o) Source #

reset :: sul i o -> m (sul i o) Source #

Instances

Instances details
SUL (MealyAutomaton s) Identity Source # 
Instance details

Defined in Haal.Automaton.MealyAutomaton

Methods

step :: MealyAutomaton s i o -> i -> Identity (MealyAutomaton s i o, o) Source #

reset :: MealyAutomaton s i o -> Identity (MealyAutomaton s i o) Source #

SUL (MooreAutomaton s) Identity Source # 
Instance details

Defined in Haal.Automaton.MooreAutomaton

Methods

step :: MooreAutomaton s i o -> i -> Identity (MooreAutomaton s i o, o) Source #

reset :: MooreAutomaton s i o -> Identity (MooreAutomaton s i o) Source #

type StateID = Int Source #

The StateID type is an alias for an integer that represents the state of the automaton. - It is used as a default type for the state of learned automata.

type Finite i = (Enum i, Bounded i) Source #

Finite is an alias for (Enum, Bounded).

type FiniteEq i = (Eq i, Finite i) Source #

FiniteEq is an alias for (Eq, Finite).

type FiniteOrd i = (Ord i, Finite i) Source #

FiniteOrd is an alias for (Ord, Bounded).

inputs :: FiniteOrd i => sul i o -> Set i Source #

Return a Set containing only the valid inputs of the SUL.

outputs :: FiniteOrd o => sul i o -> Set o Source #

Return a Set containing only the valid outputs of the SUL.

walk :: SUL sul m => sul i o -> [i] -> m (sul i o, [o]) Source #

Generalization of step that operates on a list of inputs.

stepPure :: SUL sul Identity => sul i o -> i -> (sul i o, o) Source #

Pure instance of step.

walkPure :: SUL sul Identity => sul i o -> [i] -> (sul i o, [o]) Source #

Pure instance of walk.

resetPure :: SUL sul Identity => sul i o -> sul i o Source #

Pure instance of reset.

initial :: Automaton aut s => aut s i o -> s Source #

Return the initial state of an automaton.

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

Returns an input sequence that distinguishes the given states in the given automaton.

accessSequences :: forall s i o aut. (Automaton aut s, FiniteOrd i, Ord s) => aut s i o -> Map s [i] Source #

Returns a map containing the shortest sequence to access each reachable state from the initial state.

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

Returns a set of lists of inputs that can be used to distinguish between the given state and - any other state of the automaton.

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

Returns a set of lists of inputs that can be used to distinguish between any two different states of the automaton.

reachable :: forall s i o aut. (Automaton aut s, Ord s, FiniteOrd i) => aut s i o -> Set s Source #

Return the set of reachable states of an automaton.