Averest


Automata Module

This module implements functions for working with automata, in particular, determinizing them by Rabin-Scott and the Breakpoint construction, as well as converting omega-automata to other acceptance conditions.

Types

Type Description

Automaton

This denotes the type of an automaton. States are unsigned integers, and inputs and outputs symbols are listed as strings, where outputs can be simply empty. Hence, the transitions are tuples (s1,a,b,s2) where state s1 makes a transition to state s2 when reading input letter a and then outputs b. The automaton may also have accepting states which can be also endowed with inputs to model edge automata.

AutomatonSymbolic

This data type implements a symbolic description of an automaton: States are identified with the set of variables that hold in that state, and in addition to the formulas that encode the initial states and transitions, there is also a set of fairness constraints (of type GF) to define fair computations (these are the only ones that are considered).

Functions and values

Function or value Description

AutomataTool qscoll

Full Usage: AutomataTool qscoll

Parameters:

This is the cgi-function for the automaton constructions.

qscoll : NameValueCollection

Automaton2Dot bundle ostr statePrefix lblFun auto

Full Usage: Automaton2Dot bundle ostr statePrefix lblFun auto

Parameters:

write Automaton to a dot file to output stream ostr using statePrefix as name prefix of the states, and lblFun as optional function to give states an additional label (otherwise their name defined by statePrefix and their index is is used as the only label). The parameter "bundle" draws only one transition between a state pair that contains then the bundled list of input/output pairs instead of single transitions for each input and output combination between the same states.

bundle : bool
ostr : TextWriter
statePrefix : string
lblFun : int -> string
auto : Automaton

Automaton2Kripke statePrefix auto

Full Usage: Automaton2Kripke statePrefix auto

Parameters:
Returns: KripkeStructure

convert Automaton to a corresponding Kripke structure

statePrefix : string
auto : Automaton
Returns: KripkeStructure

Breakpoint auto

Full Usage: Breakpoint auto

Parameters:
Returns: Automaton * Map<int, (Set<int> * Set<int>)>

This function applies the Breakpoint construction to construct a deterministic automaton whose states are pairs of sets of states of the given automaton such that ((q,qf),a,(q',qf')) is a transition iff there were states s,s' in q and q', respectively with (s,a,s'), and qf is the subset of states of q where since the last breakpoint only accepting states could be used to reach these states. In addition to the automaton, the function also returns a mapping from new states to the state sets they represent.

auto : Automaton
Returns: Automaton * Map<int, (Set<int> * Set<int>)>

CheckConsistency auto

Full Usage: CheckConsistency auto

Parameters:
Returns: bool

Check some consistency properties of an automaton record. It is checked that all transitions are appropriate and that the

auto : Automaton
Returns: bool

ComputeReachableStatesByBdds stateVars initCond transRel

Full Usage: ComputeReachableStatesByBdds stateVars initCond transRel

Parameters:
Returns: Set<Set<BoolExpr>>

ComputeReachableStates computes the reachable states of an automaton which is given by the set of its state variables, its initial condition on the state variables, and the transition relation where the state variables and input variables (atoms) occur as well as BoolNext occurrences of the state variables (but not of the inputs). The procedure makes use of BDDs in that the transition relation is constructed with the variable ordering Xq1;...;XqN;q1;...;qN;a1;...;aM. Then, the inputs are existentially quantified in that the disjunction of the subtrees that start with (next) state variables is computed. Then, the reachable states are computed in a fixpoint computation where the conjunction with the modified transition relation and the so far computed reachable states is computed. The next states are then obtained by the disjunction of the subtrees starting with next state variables, but of course, that BDD must then be relabeled so it is expressed with the corresponding now state variables instead of the next state vars. Finally, the satisfying cubes are computed from the BDD of the reachable states, and these cubes are then extended to minterms which are encoded as sets of sets of state variables, so that a minterm corresponds with the state variables that have positive occurrences in the minterm. The function makes use of several computed tables to avoid computations on the same shared subtrees of the BDDs.

stateVars : Set<BoolExpr>
initCond : BoolExpr
transRel : BoolExpr
Returns: Set<Set<BoolExpr>>

ComputeSpecialStatesAuto auto

Full Usage: ComputeSpecialStatesAuto auto

Parameters:
Returns: Set<int> * Set<int> * Set<int>
auto : Automaton
Returns: Set<int> * Set<int> * Set<int>

EncodeAutomaton auto

Full Usage: EncodeAutomaton auto

Parameters:
Returns: (BoolExpr list * BoolExpr list * BoolExpr list * BoolExpr list) * (bool list * bool list * bool list * bool list) list * BoolExpr * BoolExpr * Map<BoolExpr, BoolExpr>

encode a deterministic Mealy machine by boolean state variables and compute the required boolean functions for output and state variables. Given an automaton, the function returns (sVars,iVars,oVars,sVars') which are the lists of state/input/output/next state variables, boolTransRel which is a list of transitions (qv,xv,yv,qv') where each component is a bitvector encoding a state, input, output and next state, a boolean expression transRel that is the transition relation even for nondeterministic automata, a boolean expression careSet on state and input variables careSet which denotes the care set and minBoolFun which is a map that maps variables in oVars and sVars' to corresponding boolean expression that define them in terms of state and input variables in case the given automaton is deterministic.

auto : Automaton
Returns: (BoolExpr list * BoolExpr list * BoolExpr list * BoolExpr list) * (bool list * bool list * bool list * bool list) list * BoolExpr * BoolExpr * Map<BoolExpr, BoolExpr>

EquivalentFSA auto1 auto2

Full Usage: EquivalentFSA auto1 auto2

Parameters:
Returns: bool * bool[][]

Check whether two given FSAs (on finite words) are equivalent to each other. The function returns a pair (isEqual,equal) where isEqual holds iff the two automata are equivalent, and equal is a boolean matrix that shows which states of the first automaton are equivalent to which states of the second automaton. Note that both automata have to be deterministic otherwise the result may not be correct.

auto1 : Automaton
auto2 : Automaton
Returns: bool * bool[][]

FlipFlopControlLogic (arg1, careSet, boolFun)

Full Usage: FlipFlopControlLogic (arg1, careSet, boolFun)

Parameters:
Returns: Map<'b, ((BoolExpr * BoolExpr) * (BoolExpr * BoolExpr) * BoolExpr)>

This function compute for SR-, JK- and T-flipflops the control logic. These functions are stored in a map that maps next state variables to the control logic functions.

arg0 : BoolExpr list * BoolExpr list * 'a * 'b list
careSet : BoolExpr
boolFun : Map<'b, BoolExpr>
Returns: Map<'b, ((BoolExpr * BoolExpr) * (BoolExpr * BoolExpr) * BoolExpr)>

MinimalFSA auto

Full Usage: MinimalFSA auto

Parameters:
Returns: Automaton * bool[][] * Map<int, int>

Minimize a given FSA (on finite words): Note that the given automaton has to be deterministic.

auto : Automaton
Returns: Automaton * bool[][] * Map<int, int>

ParseAutomaton s

Full Usage: ParseAutomaton s

Parameters:
    s : string

Returns: Automaton

parsing an automaton from a string; the syntax is explained by the following example: inputs a,b; outputs c,d; init 0,1; transitions (0,a,c,1); (0,b,d,0); (1,a,d,1); (1,b,c,0); accept 1;

s : string
Returns: Automaton

PrintAutomatonForTeachingTool ostr auto

Full Usage: PrintAutomatonForTeachingTool ostr auto

Parameters:

print input text for teaching tool

ostr : TextWriter
auto : Automaton

PrintEquivRelTable equal

Full Usage: PrintEquivRelTable equal

Parameters:
    equal : bool[][]

print the equivalence relation of EquivalentFSA or MinimalFSA

equal : bool[][]

PrintTransitionTable (sVars, iVars, oVars, sVars') explTransRel

Full Usage: PrintTransitionTable (sVars, iVars, oVars, sVars') explTransRel

Parameters:

print the truth table for the output and next state variables

sVars : BoolExpr list
iVars : BoolExpr list
oVars : BoolExpr list
sVars' : BoolExpr list
explTransRel : seq<bool list * bool list * bool list * bool list>

RabinScott auto

Full Usage: RabinScott auto

Parameters:
Returns: Automaton * Map<int, Set<int>>

This function applies the Rabin-Scott subset construction to construct a deterministic automaton whose states are sets of states of the given automaton such that (q,a,q') is a transition iff there were states s,s' in q and q', respectively with (s,a,s'). In addition to the automaton, the function also returns a mapping from new states to the state sets they represent.

auto : Automaton
Returns: Automaton * Map<int, Set<int>>

Symbolic2Explicit auto

Full Usage: Symbolic2Explicit auto

Parameters:
Returns: (BoolExpr * bool) list[] * Map<string, (BoolExpr * bool) list> * Automaton

Convert a symbolic automaton to an explicit one where also the inputs are fully enumerated.

auto : AutomatonSymbolic
Returns: (BoolExpr * bool) list[] * Map<string, (BoolExpr * bool) list> * Automaton

Symbolic2PartialExplicit auto

Full Usage: Symbolic2PartialExplicit auto

Parameters:
Returns: Map<BoolExpr, bool>[] * Automaton

Convert a symbolic automaton to an explicit one where the input is kept as a formula on the input/output variables.

auto : AutomatonSymbolic
Returns: Map<BoolExpr, bool>[] * Automaton

SymbolicAutomataTool qscoll

Full Usage: SymbolicAutomataTool qscoll

Parameters:

This is the cgi-function for converting symbolic automata to explicitly defined ones

qscoll : NameValueCollection

SymbolicBreakpoint qDet bDet stateVars initCond transRel acpCond reachStates

Full Usage: SymbolicBreakpoint qDet bDet stateVars initCond transRel acpCond reachStates

Parameters:
Returns: SpecExpr

This function computes a symbolic representation of a deterministic automaton for a given nondeterministic automaton using the breakpoint construction. The deterministic automaton is computed similarly to the one of SymbolicRabinScott, but adds additional state variables b[i] that denote if the corresponding states p[i] belongs to the breakpoint set.

qDet : string
bDet : string
stateVars : Set<BoolExpr>
initCond : BoolExpr
transRel : BoolExpr
acpCond : BoolExpr
reachStates : seq<Set<BoolExpr>>
Returns: SpecExpr

SymbolicRabinScott qDet stateVars initCond transRel acpCond reachStates

Full Usage: SymbolicRabinScott qDet stateVars initCond transRel acpCond reachStates

Parameters:
Returns: SpecExpr

This function computes a symbolic representation of a deterministic automaton for a given nondeterministic automaton. The nondeterministic automaton is given by its state variables, its initial condition, its transition relation, its acceptance condition, and the explicitly enumerated set of its reachable states in terms of minterms which are sets of state variables that contain those state variables that have positive occurrences in the minterm, i.e. which hold on the state. The latter can be computed by function ComputeReachableStatesByBdds. The determinization function associates then each reachable state (minterm, set of state variables) with a new state variable of the deterministic automaton whose name starts with the prefix "qDet". This way, a minterm on the new state variables corresponds with a set of sets of states of the nondeterministic automaton, since a minterm on the new state variables corresponds with a set of new state variables which is therefore a set of set of minterms of the old state variables, i.e., a set of set of states of the nondeterministic automaton. Details on the construction are given in MoSL08. Note that the transition equations are of the form next(pi) <-> p1&phi[i,1] | ... | pN&phi[i,N] where phi[i,j] is the set of inputs that trigger a transition from state pj to state pi in the nondeterministic automaton. This corresponds with the existential successor computation where pi is added to a successor state if one state pj can reach pi with input phi[i,j].

qDet : string
stateVars : Set<BoolExpr>
initCond : BoolExpr
transRel : BoolExpr
acpCond : BoolExpr
reachStates : seq<Set<BoolExpr>>
Returns: SpecExpr

computeTransitionMonoid auto

Full Usage: computeTransitionMonoid auto

Parameters:
Returns: bool[,][] * int[,] * Set<string list> option[] * bool * (int list * int)[]

This function computes the transition monoid of the given automaton with further information: For every input symbol, we consister the state transitions induced by that input symbol as a boolean matrix and compute the closure of these boolean matrices under matrix multiplication. The resulting matrices form the transition monoid and partition all words of the input language into equivalence classes that lead to the same state transitions (considering all states). The result (matrix,transTable,assocInputs,aperiodic,period) of the function contains the matrices matrix[0..] of the monoid, their product table (where transTable[i,j] = p encodes that matrix[p] is the product of matrices matrix[i] and matrix[j]), assocInputs[i] is the set of inputs that induce matrix[i] (if the matrix is induced by inputs), period[i] is a pair ([i1,...,iN],p) such that p is the period of matrix[i] and [i1,...,iN] is the sequence obtained by computing exponents of that matrix. Finally, aperiodic holds if all periods are 1 which means that the automaton is noncounting, i.e., its monoid has only trivial subgroups, i.e., the automaton can also be expressed as a temporal logic formula.

auto : Automaton
Returns: bool[,][] * int[,] * Set<string list> option[] * bool * (int list * int)[]