pub struct Automaton { /* private fields */ }
Expand description
Deterministic finite state automaton
Implementations§
Source§impl Automaton
impl Automaton
Sourcepub fn initial_state(&self) -> &State
pub fn initial_state(&self) -> &State
Get the initial state
Sourcepub fn state(&self, id: usize) -> &State
pub fn state(&self, id: usize) -> &State
Get a state from its id panics if the id is out of range
Sourcepub fn num_states(&self) -> usize
pub fn num_states(&self) -> usize
Number of states
Sourcepub fn num_final_states(&self) -> usize
pub fn num_final_states(&self) -> usize
Number of final states
Sourcepub fn default_successor(&self, s: &State) -> Option<&State>
pub fn default_successor(&self, s: &State) -> Option<&State>
Default successor of a state
Sourcepub fn class_next(&self, s: &State, cid: ClassId) -> &State
pub fn class_next(&self, s: &State, cid: ClassId) -> &State
Successor for a character class
The class id must be valid for state s
§Panics
If cid is of the form ClassId::Interval(i) but i is larger than the number of successors of s.
If cid is of the form ClassId::Complement but s has no default successor.
Sourcepub fn char_set_next(&self, s: &State, set: &CharSet) -> Result<&State, Error>
pub fn char_set_next(&self, s: &State, set: &CharSet) -> Result<&State, Error>
Successor of a state via a character set
§Errors
If this set overlaps two or more successor classes, produce Error::AmbiguousCharSet.
Sourcepub fn str_next<'a>(&'a self, s: &'a State, str: &SmtString) -> &'a State
pub fn str_next<'a>(&'a self, s: &'a State, str: &SmtString) -> &'a State
Successor of a state via an SMT string
Sourcepub fn edges<'a>(&'a self, s: &'a State) -> EdgeIterator<'a> ⓘ
pub fn edges<'a>(&'a self, s: &'a State) -> EdgeIterator<'a> ⓘ
Iterator to list the out edges of a state
The iterator produces a list of pairs (ClassId, SuccessorState) for every class in the state’s character partition.
Sourcepub fn final_states(&self) -> FinalStateIterator<'_> ⓘ
pub fn final_states(&self) -> FinalStateIterator<'_> ⓘ
Iterator to list the final states
Sourcepub fn combined_char_partition(&self) -> CharPartition
pub fn combined_char_partition(&self) -> CharPartition
Merge the state partitions and return the result. This returns an abstraction of the automaton’s alphabet.
Every class in the returned partition contains equivalent characters: if c1 and c2 are in one class, then delta(s, c1) = delta(s, c2) for every state s of the automaton.
Sourcepub fn pick_alphabet(&self) -> Vec<u32>
pub fn pick_alphabet(&self) -> Vec<u32>
Get a representative character from the combined partition
Sourcepub fn compile_successors(&self) -> CompactTable
pub fn compile_successors(&self) -> CompactTable
Compile the successor function.
The successor function is defined on state indices and character indices and it returns a state index. More precisely, it starts with building the representative alphabet for this automaton (see pick_alphabet). If the automaton has N states and the representative alphabet has M characters, then the compiled successor function is defined on [0 .. N-1] x [0 .. M-1] and return an index in [0 .. N-1].
Sourcepub fn remove_unreachable_states(&mut self)
pub fn remove_unreachable_states(&mut self)
Remove unreachable states