ppFm
functor
functor ppFm
(LABEL) : sig ... end
This functor generates from an alphabet of labels a structure with functions to create, transform, and display finite machines over the alphabet.
The display-function assumes that the graph-drawing program dot of ATT is available in /usr/local/bin. (Some error messgages need to be added to the code.)
include FM
eqtype label = Alphabet.label
val dot : label machine -> string -> unit
val viewgraph : string -> OS.Process.status
val display : label machine -> string -> OS.Process.status
val displayMinimize : label machine
-> string -> OS.Process.status
val displayDetermine : label machine
-> string -> OS.Process.status
val displayDetermineMinimize : label machine
-> string
-> OS.Process.status
val displayMinimizeHistory : label machine
-> string
-> OS.Process.status
eqtype label = Alphabet.label
dot m s
viewgraph s
display m s
States are displayed with an elliptic shape, except that the shape of initial states is a diamond, and the final states have a double border line.
displayMinimize m s
displayDetermine m s
displayDetermineMinimize m s
displayMinimizeHistory m s
If a state i is split, a new state j is created that contains some of m's state numbers contained in i. The sequence of graphs does this in two steps: first, a graph is shown in which some arcs leaving i (namely, those whose source in m has been moved to j) are replaced by arcs leaving state j, but some arcs leading to state i still have to be redirected to j. This is done in the next graph.
LABEL, FM, ppRegExpFm
Example:
Define a deterministic machine (with unreachable state 4) and display its graph:
structure sM = ppFm(StringLabels); val M = sM.make{start = [1], final = [3], trans = [(1,"a",2),(1,"b",6),(2,"a",7),(2,"b",3), (3,"a",1),(3,"b",3),(4,"a",3),(4,"b",7), (5,"a",8),(5,"b",6),(6,"a",3),(6,"b",7), (7,"a",7),(7,"b",5),(8,"a",7),(8,"b",3)]}; sM.display M "Mdet";Since M was deterministic, making it deterministic shows that each equivalence class of states has a single member, but the unreachable state 4 is removed:val (Md,EquivStates) = sM.determineWithStateAssoc M; val Md = - : string machine val EquivStates = [(0,[1]),(1,[6]),(2,[2]),(3,[7]),(4,[3]),(5,[5]),(6,[8])] : (int * int list) listTo relate states of M to states of the minimal automaton equivalent to M, inspect the sequence of graphs produced by:sM.displayDetermineMinimize M "Mmin";