62 operator dfa const&()
const;
121 return &(lhs.get()) == &(rhs.get()) && lhs.get() == rhs.get();
u32string findShortestWord_(dfa const &d)
Searches the shortest UTF-32-encoded word accepted by a given DFA.
std::unordered_set< std::reference_wrapper< std::string const >, hash_reference_string_const, equal_to_reference_string_const > state_set
Nicer name for sets of names of states. Should store references to existing state names...
string findShortestWord(dfa const &d)
Searches the shortest UTF-8-encoded word accepted by a given DFA.
friend std::string findShortestWord(nfa const &n)
Same as above for a UTF-8-encoded word.
Represents nondeterministic finite automata with ε-moves.
static fabuilder subtract(nfa const &n1, nfa const &n2)
Creates a builder for an NFA accepting the set difference of the languages of two NFAs...
Represents deterministic finite automata.
bool operator==(nfa const &n) const
Checks whether this NFA describes the same regular language as another object.
std::vector< char32_t > const & getAlphabet_() const
Fetches this NFA's set of processable symbols.
size_t operator()(std::reference_wrapper< std::string const > const &ref) const
Delegates hashing to referenced objects.
std::string to_string(std::valarray< bool > const &qs) const
Puts a name to a set of indices.
nfa & operator=(nfa const &n)
Copy-assigns this NFA by copying another one's private implementation object.
Contains utility classes, objects and functions used throughout the library.
std::valarray< bool > encodeSet(state_set const &qs) const
Translates a set of states from set to bool representation.
bool operator!=(nfa const &n) const
Checks whether this NFA describes a different regular language than another object.
Provides std::unordered_set::key_eq for state_set.
state_set getStatesSet() const
Fetches this NFA's set of states as a set of (references to) strings.
std::valarray< bool > deltaHat(size_t qi, std::string const &word) const
Computes this DFA's transition function recursively for a UTF-8-encoded string of symbols...
static fabuilder intersect(nfa const &n1, nfa const &n2)
Creates a builder for an NFA accepting the intersection of the languages of two NFAs.
Provides std::unordered_set::hash_function for state_set.
state_set decodeSet(std::valarray< bool > const &qs) const
Translates a set of states from bool to set representation.
bool isAccepting(size_t qi) const
Tests whether a state is an accept state within this NFA.
std::valarray< bool > const & delta_(size_t qi, char32_t u32symbol) const
Computes this NFA's transition function for a state index and a UTF-32-encoded symbol.
friend std::u32string findShortestWord_(nfa const &n)
Searches the shortest UTF-32-encoded word accepted by a given NFA.
Constructs NFAs step by step.
std::valarray< bool > getStatesBools() const
Fetches this NFA's set of states encoded as an array of bools.
Where this library lives.
nfa()
Constructs an NFA accepting the empty language ∅.
std::string const & getInitialState() const
Names this NFA's initial state.
static fabuilder unite(nfa const &n1, nfa const &n2)
Creates a builder for an NFA accepting the union of the languages of two NFAs.
std::valarray< bool > const & delta(size_t qi, size_t si) const
Computes this NFA's transition function for a state index and a symbol index.
std::valarray< bool > const & epsilonClosure(size_t qi) const
Computes a state's ε-closure.
std::vector< std::string > const & getStates() const
Fetches this NFA's set of states in order of internal representation.
std::valarray< bool > deltaHat_(size_t qi, std::u32string const &u32word) const
Computes this NFA's transition function recursively for a string of symbols, starting in a state spec...
bool operator()(std::reference_wrapper< std::string const > const &lhs, std::reference_wrapper< std::string const > const &rhs) const
Delegates equality check to referenced objects.
static fabuilder complement(nfa const &n)
Creates a builder for an NFA accepting the complement of the language of an NFA.
std::vector< std::string > const & getAlphabet() const
Fetches this NFA's set of processable symbols as UTF-8-encoded strings.