use std::collections::HashSet;
use crate::general::Automaton;
pub trait FiniteAutomaton: Automaton + Sized {
fn alphabet_set(&self) -> HashSet<Self::Input> {
self.alphabet().collect()
}
fn states_set(&self) -> HashSet<Self::State> {
self.states().collect()
}
fn accepting_states_set(&self) -> HashSet<Self::State> {
self.accepting_states().collect()
}
fn common_alphabet(&self, other: &Self) -> HashSet<Self::Input> {
let alphabet1: HashSet<Self::Input> = self.alphabet_set();
let alphabet2: HashSet<Self::Input> = other.alphabet_set();
alphabet1.intersection(&alphabet2).cloned().collect()
}
}