pub fn new(spec: &RewriteSpecification, annotate: impl Fn(&Rule) -> M, apma: bool) -> SetAutomaton<M> {
// The initial state has a match goals for each pattern. For each pattern l there is a match goal
pub fn to_dot_graph(&self, show_backtransitions: bool, show_final: bool) -> DotFormatter<'_, M> {
/// Derive transitions from a state given a head symbol. The resulting transition is returned as a tuple
/// The tuple consists of a vector of outputs and a set of destinations (which are sets of match goals).
/// We don't use the struct Transition as it requires that the destination is a full state, with name.
/// Since we don't yet know whether the state already exists we just return a set of match goals as 'state'.
.any(|mo| mo.position == self.label && mo.pattern.data_function_symbol() != symbol.copy())
fn add_symbol(function_symbol: DataFunctionSymbol, arity: usize, symbols: &mut HashMap<DataFunctionSymbol, usize>) {
/// Returns false iff this is a higher order term, of the shape t(t_0, ..., t_n), or an unknown term.
fn find_symbols(t: &DataExpressionRef<'_>, symbols: &mut HashMap<DataFunctionSymbol, usize>) {