Interface
KnuthBendix.Automata.Automaton
— TypeAutomaton{S} aka. DFA
Struct for deterministic finite automata (DFA) with states of type S
.
KnuthBendix.Automata.initial
— Functioninitial(A::Automaton)
Return the initial state of a (deterministic) automaton.
KnuthBendix.Automata.hasedge
— Functionhasedge(A::Automaton, σ, label)
Check if A
contains an edge starting at σ
labeled by label
KnuthBendix.Automata.isfail
— Functionisfail(A::Automaton, σ)
Check if state σ
is a fail state in automaton A
.
KnuthBendix.Automata.isaccepting
— Functionisaccepting(A::Automaton, σ)
Check if state σ
is an accepting (terminal) state of automaton A
.
KnuthBendix.Automata.trace
— Functiontrace(label, A::Automaton, σ)
Return τ
if (σ, label, τ)
is in A
, otherwise return nothing.
trace(w::AbstractVector, A::Automaton[, σ=initial(A)])
Return a pair (l, τ)
, where
l
is the length of the longest prefix ofw
which defines a path starting
at σ
in A
and
τ
is the last state (node) on the path.
If w
defines a path to a fail state the last non-fail state will be
returned.
Proving finiteness
KnuthBendix.Automata.infiniteness_certificate
— Functioninfiniteness_certificate(ia::IndexAutomaton)
Find a family of irreducible words of unbounded length if it exists.
Returns a witness w
of the infiniteness, i.e.
[w.prefix * w.suffix^n for n in ℕ]
is an infinite family of words irreducible with respect to ia
.
Conversly if w.suffix
is the trivial word no such infinite family exists and therefore the there are only finitely many irreducible words for ia
.
Base.isfinite
— Methodisfinite(ia::Automaton)
Return true
if the language of the automaton is proven to be finite.
KnuthBendix.Automata.irreducible_words
— Functionirreducible_words(a::Automaton[, min_length=0, max_length=typemax(UInt)])
All words from the language of a
, of length between min_length
and max_length
.
The words are returned form depth-first search, and hence are not ordered lexicographically.