Interface and canonical algorithms for NFAs and DFAs