In this simple language, we can express types such as the following:
Not(Or{Int,Bool})
--- the set of values excluding the integers and booleansAnd{Int,Bool}
--- the set of values in both the integers and booleans (i.e. the empty set).Not(Void)
--- this corresponds to an automaton with two states: 1) a term with no child representing Void
; 2) a term representing Not
which has a single child referring to state 1.Or{Int,Bool}
--- corresponds to an automaton with four states: 1) a term with no child representing Int
; 2) a term with no child representing Bool
; 3) a set with two children referring to states 1 and 2; 4) a term representing Or
with a single child referring to state 3.Roots. States can be explicitly marked as roots to provide a way to track them through the various operations that might be performed on an automaton. In particular, as states are rewritten, the roots will be updated accordingly.
Minimisation. An automaton which has the strong equivalence property is said to be minimised. Automata are generally kept in the minimised form, and only use of the set()
method can break this. The strong equivalence property guarantees that there are no two distinct, but equivalent states. In order to restore this property, the minimise()
function must be called explicitly.
Compaction. An automaton which does not contain garbage states is said to be compacted. Automata are generally kept in compacted form, and only use of the set()
method can break this. Garbage states are those not reachable from any marked root state. In order to restore this property, the compact()
function must be called explicitly.
Canonical Form. An automaton which is minimised is not guaranteed to be canonical. This means we can have automata which are effectively equivalent, but which not considered identical (i.e., where equals()
returns false). In some circumstance, it is desirable to move an automaton into canonical form, and this can be achieved with the canonicalise()
function.
Virtual States. In the internal representation of automata, leaf states may be not be represented as actual states. This will occur if the leaf node does not include any supplementary data, and is primarily for space and performance optimisation. In such case, the node is represented as a child node using a negative index.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|