6#include <ext/algorithm>
14namespace determinize {
16template <
class SymbolType,
class StateType >
19 resultTransition [
ext::make_pair ( symbol, transitionLHS ) ].insert ( rhs );
22 transitionLHS.push_back ( dftaState.second );
23 constructTransitions ( symbol, std::next ( state ),
end, rhs, nftaStateToDftaStates, transitionLHS, resultTransition );
24 transitionLHS.pop_back ( );
29template <
class SymbolType,
class StateType >
38 if ( symbol.getRank ( ) != 0 )
44 dftaState.insert ( transition.second );
46 for (
const auto & state : dftaState )
47 nftaStateToDftaStates.
insert ( state, dftaState );
49 res.addState ( dftaState );
62 constructTransitions ( transition.first.first, transition.first.second.begin ( ), transition.first.second.end ( ), transition.second, nftaStateToDftaStates, transitionLHS, transitions );
66 if (
res.addState ( transition.second ) ) {
69 for (
const auto & state : transition.second )
70 nftaStateToDftaStates.
insert ( state, transition.second );
72 res.addTransition ( transition.first.first, transition.first.second, transition.second );
79 if ( !
ext::excludes ( finalLabels.
begin ( ), finalLabels.
end ( ), dfaState.begin ( ), dfaState.end ( ) ) )
80 res.addFinalState ( dfaState );
86template <
class SymbolType,
class StateType >
89 resultTransition [
ext::make_pair ( symbol, transitionLHS ) ].insert ( rhs );
92 transitionLHS.insert ( dftaState.second );
93 constructTransitions ( symbol, std::next ( state ),
end, rhs, nftaStateToDftaStates, transitionLHS, resultTransition );
94 transitionLHS.erase ( transitionLHS.find ( dftaState.second ) );
99template <
class SymbolType,
class StateType >
108 if ( symbol.getRank ( ) != 0 )
114 dftaState.insert ( transition.second );
116 for (
const auto & state : dftaState )
117 nftaStateToDftaStates.
insert ( state, dftaState );
119 res.addState ( dftaState );
132 constructTransitions ( transition.first.first, transition.first.second.begin ( ), transition.first.second.end ( ), transition.second, nftaStateToDftaStates, transitionLHS, transitions );
136 if (
res.addState ( transition.second ) ) {
139 for (
const auto & state : transition.second )
140 nftaStateToDftaStates.
insert ( state, transition.second );
142 res.addTransition ( transition.first.first, transition.first.second, transition.second );
149 if ( !
ext::excludes ( finalLabels.
begin ( ), finalLabels.
end ( ), dfaState.begin ( ), dfaState.end ( ) ) )
150 res.addFinalState ( dfaState );
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: DFTA.h:74
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: NFTA.h:72
const ext::set< StateType > & getFinalStates() const &
Definition: NFTA.h:159
const ext::multimap< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > & getTransitions() const &
Definition: NFTA.h:294
const ext::set< common::ranked_symbol< SymbolType > > & getInputAlphabet() const &
Definition: NFTA.h:208
Deterministic unordered finite tree automaton without epsilon transitions. Accepts regular tree langu...
Definition: UnorderedDFTA.h:72
Nondeterministic unordered finite tree automaton without epsilon transitions. Accepts regular tree la...
Definition: UnorderedNFTA.h:72
const ext::set< StateType > & getFinalStates() const &
Definition: UnorderedNFTA.h:159
const ext::multimap< ext::pair< common::ranked_symbol< SymbolType >, ext::multiset< StateType > >, StateType > & getTransitions() const &
Definition: UnorderedNFTA.h:294
const ext::set< common::ranked_symbol< SymbolType > > & getInputAlphabet() const &
Definition: UnorderedNFTA.h:208
static automaton::DFA< SymbolType, StateType > determinize(const automaton::DFA< SymbolType, StateType > &automaton)
Definition: Determinize.h:276
Definition: ranked_symbol.hpp:20
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the multimap class from the standard library. Original reason is to allow printing of...
Definition: multimap.hpp:48
iterator insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: multimap.hpp:118
Definition: multiset.hpp:44
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: set.hpp:99
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
auto equal_range(K &&key) const &
Make range of elements with key equal to the key.
Definition: set.hpp:200
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
typename std::vector< T, Alloc >::const_iterator const_iterator
The type of constant values iterator.
Definition: vector.hpp:67
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
void constructTransitions(const common::ranked_symbol< SymbolType > &symbol, typename ext::vector< StateType >::const_iterator state, typename ext::vector< StateType >::const_iterator end, const StateType &rhs, const ext::multimap< StateType, ext::set< StateType > > &nftaStateToDftaStates, ext::vector< ext::set< StateType > > &transitionLHS, ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< ext::set< StateType > > >, ext::set< StateType > > &resultTransition)
Definition: DeterminizeNFTAPart.hxx:17
return res
Definition: MinimizeByPartitioning.h:145
Definition: ToGrammar.h:31
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
bool excludes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
Tests two sorted ranges wheter all elements from the second are not present in the first.
Definition: algorithm.hpp:46
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
void end()
Definition: measurements.cpp:19