FA Module
signature FA
structure FA :> FA
This module defines the abstract type of finite automata (FAs).
type concr = {
stats : Sym.sym Set.set,
start : Sym.sym,
accepting : Sym.sym Set.set,
trans : Tran.tran Set.set
}
type fa
val valid : concr -> bool
val fromConcr : concr -> fa
val toConcr : fa -> concr
val fromString : string -> fa
val input : string -> fa
val toPP : fa -> PP.pp
val toString : fa -> string
val output : string * fa -> unit
val states : fa -> Sym.sym Set.set
val startState : fa -> Sym.sym
val acceptingStates : fa -> Sym.sym Set.set
val transitions : fa -> Tran.tran Set.set
val compare : fa Sort.total_ordering
val equal : fa * fa -> bool
val numStates : fa -> int
val numTransitions : fa -> int
val alphabet : fa -> Sym.sym Set.set
val sub : fa * fa -> bool
val transitionFun : fa -> Sym.sym * Str.str -> Sym.sym Set.set
val transitionFunBackwards : fa -> Sym.sym * Str.str -> Sym.sym Set.set
val processStr : fa -> Sym.sym Set.set * Str.str -> Sym.sym Set.set
val accepted : fa -> Str.str -> bool
val reachableStates : fa -> Sym.sym Set.set
val liveStates : fa -> Sym.sym Set.set
val deadStates : fa -> Sym.sym Set.set
val reachified : fa -> bool
val emptyClose : fa -> Sym.sym Set.set -> Sym.sym Set.set
val emptyCloseBackwards : fa -> Sym.sym Set.set -> Sym.sym Set.set
val renameStates : fa * SymRel.sym_rel -> fa
val renameStatesCanonically : fa -> fa
val isomorphism : fa * fa * SymRel.sym_rel -> bool
val findIsomorphismOpt : fa * fa -> SymRel.sym_rel option
val findIsomorphism : fa * fa -> SymRel.sym_rel
val isomorphic : fa * fa -> bool
val renameAlphabet : fa * SymRel.sym_rel -> fa
val checkLP : fa -> LP.lp -> unit
val validLP : fa -> LP.lp -> bool
val findLPOpt : fa -> Sym.sym Set.set * Str.str * Sym.sym Set.set -> LP.lp option
val findLP : fa -> Sym.sym Set.set * Str.str * Sym.sym Set.set -> LP.lp
val findAcceptingLPOpt : fa -> Str.str -> LP.lp option
val findAcceptingLP : fa -> Str.str -> LP.lp
val emptyStr : fa
val emptySet : fa
val fromSym : Sym.sym -> fa
val simplify : fa -> fa
val simplified : fa -> bool
val union : fa * fa -> fa
val concat : fa * fa -> fa
val closure : fa -> fa
val genUnion : fa list -> fa
val genConcat : fa list -> fa
val rev : fa -> fa
val fromStr : Str.str -> fa
val fromReg : Reg.reg -> fa
val jforlanNew : unit -> fa
val jforlanEdit : fa -> fa
val jforlanValidate : string -> unit
val jforlanPretty : string -> unit
type concr = {
stats : Sym.sym Set.set,
start : Sym.sym,
accepting : Sym.sym Set.set,
trans : Tran.tran Set.set
}
stats ("states") of symbols, a symbol start ("start state"), a finite set accepting ("accepting states") of symbols, and a finite set trans ("transitions") of transitions.
type fa
concr of type concr such that:
#start concr is an element of #stats concr;
#accepting concr is a subset of #stats concr; and
(q, x, r) of #trans
concr, q and r are elements of #stats concr.
concr is valid iff concr satisfies the above conditions.
valid concr
concr is valid.
fromConcr concr
concr. Issues an error message if concr isn't valid.
toConcr fa
fa.
fromString s
s.
input fil
fil.
toPP fa
fa.
toString fa
fa to a string.
output(fil, fa)
fa to the file fil.
states fa
fa.
startState fa
fa.
acceptingStates fa
fa.
transitions fa
fa.
compare(fa1, fa2)
case SymSet.compare(states fa1, states fa2) of
LESS => LESS
| EQUAL =>
(case Sym.compare(startState fa1, startState fa2) of
LESS => LESS
| EQUAL =>
(case SymSet.compare(acceptingStates fa1, acceptingStates fa2) of
LESS => LESS
| EQUAL =>
TranSet.compare(transitions fa1, transitions fa2)
| GREATER => GREATER)
| GREATER => GREATER)
| GREATER => GREATER
equal(fa1, fa2)
fa1 and fa2 are equal.
numStates fa
fa.
numTransitions fa
fa.
alphabet fa
fa.
sub(fa1, fa2)
fa1 is a sub-FA of fa2.
transitionFun fa (q, x)
r such that (q, x, r) is a transition of fa. Issues an error message if q is not a state of fa.
transitionFunBackwards fa (r, x)
q such that (q, x, r) is a transition of fa. Issues an error message if r is not a state of fa.
processStr fa (qs, x)
x from qs in fa. Issues an error message if qs has an element that's not a state of fa.
accepted fa x
x is accepted by fa.
reachableStates fa
fa.
liveStates fa
fa.
deadStates fa
fa.
reachify fa
fa are reachable.
emptyClose fa qs
qs for fa. Issues an error message if qs has an element that's not a state of fa.
emptyCloseBackwards fa qs
qs for fa. Issues an error message if qs has an element that's not a state of fa.
renameStates(fa, rel)
fa using the bijection rel. Issues an error message if rel is not a bijection from the states of fa to some set.
renameStatesCanonically fa
fa.
isomorphism(fa1, fa2, rel)
rel is an isomorphism from fa1 to fa2.
findIsomorphismOpt(fa1, fa2)
SOME of an isomorphism from fa1 to fa2, if fa1 and fa2 are isomorphic, and NONE, if fa1 and fa2 are not isomorphic.
findIsomorphism(fa1, fa2)
fa1 to fa2. Issues an error message if such an isomorphism doesn't exist.
isomorphic(fa1, fa2)
fa1 and fa2 are isomorphic.
renameAlphabet(fa, rel)
fa using the bijection rel. Issues an error message if rel is not a bijection from a superset of the alphabet of fa to some set.
checkLP fa lp
lp is valid for fa, silently returning (), if it is, and explaining why it isn't, if it's not.
validLP fa lp
lp is valid for fa.
findLPOpt fa (qs, x, rs)
SOME of a minimal labeled path for fa, taking qs to rs with label x, if such a labeled path exists, and NONE, if such a labeled path does not exist.
findLP fa (qs, x, rs)
fa, taking qs to rs with label x. Issues an error message if there is an element of qs or rs that isn't a state of fa, or such a labeled path doesn't exist.
findAcceptingLPOpt fa x
SOME of a minimal, accepting labeled path for fa and x, if such a labeled path exists, and NONE, if such a labeled path doesn't exist.
findAcceptingLP fa x
fa and x. Issues an error message if such a labeled path doesn't exist.
emptyStr
emptySet
fromSym a
a.
simplify fa
fa.
simplified fa
fa is simplified.
union(fa1, fa2)
fa1 and fa2.
concat(fa1, fa2)
fa1 and fa2.
closure fa
fa.
genUnion
fun genUnion nil = emptySet
| genUnion [fa] = fa
| genUnion (fa :: fas) = union(fa, genUnion fas)
genConcat
fun genConcat nil = emptyStr
| genConcat [fa] = fa
| genConcat (fa :: fas) = concat(fa, genConcat fas)
rev fa
fa.
fromStr x
x.
fromReg reg
reg to an FA.
jforlanNew()
jforlanEdit fa
fa, and returning the resulting FA that the user commits. Issues an error message if the user aborts, instead.
jforlanValidate
jforlanPretty
Forlan Version 4.15
Copyright © 2022 Alley Stoughton