It would be nice to have a Determinization/Minimization algorithm for length-preserving NFTs. Currently, there are the functions
Nft determinize(const Nft& aut, std::unordered_map<StateSet, State> *subset_map = nullptr);
Nft minimize(const Nft &aut, const ParameterMap& params = {{ "algorithm", "brzozowski" }});
declared in include/mata/nft/nft.hh and defined in src/nft/operations.cc. However, they lose the levels in the process.
Currently, one work-around (for length-preserving transducers) is to restore the levels by moving the result to an NFA and then back to an NFT with advancing levels. Or, move the NFT first to an NFA, then det/min, then move back with advancing levels:
Nft determinize(const Nft& nft) {
int levels = nft.num_of_levels;
Nfa aut {nft.to_nfa_copy()};
Nfa aut_det {determinize(aut)};
return mata::nft::builder::from_nfa_with_levels_advancing(aut_det, levels);
}
Nft minimize(const Nft& nft) {
int levels = nft.num_of_levels;
Nfa aut {nft.to_nfa_copy()};
Nfa aut_min {algorithms::minimize_hopcroft(aut)};
return mata::nft::builder::from_nfa_with_levels_advancing(aut_min, levels);
}
It would be nice to have a Determinization/Minimization algorithm for length-preserving NFTs. Currently, there are the functions
declared in
include/mata/nft/nft.hhand defined insrc/nft/operations.cc. However, they lose the levels in the process.Currently, one work-around (for length-preserving transducers) is to restore the levels by moving the result to an NFA and then back to an NFT with advancing levels. Or, move the NFT first to an NFA, then det/min, then move back with advancing levels: