Skip to content

Determinization and Minimization for length-preserving NFTs #571

@bruderjakob17

Description

@bruderjakob17

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    For:libraryThe issue is related to library (c++ implementation)Module:nftThe issue is related to Nondeterministic Finite TransducersPriority:highFocus on this before the others.Type:requiredA required implementation/change necessary in near future

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions