62 template <
class T,
class SymbolType = DefaultSymbolType,
class StateType = DefaultStateType >
72 template <
class SymbolType,
class StateType >
83 template <
class SymbolType,
class StateType >
93 template <
class SymbolType,
class StateType >
97template <
class T,
class SymbolType,
class StateType >
99 if (
automaton.getFinalStates ( ).empty ( ) )
104 extendExtendedNFTA ( extendedAutomaton );
108 std::set_difference ( extendedAutomaton.getStates ( ).begin ( ), extendedAutomaton.getStates ( ).end ( ),
109 extendedAutomaton.getFinalStates ( ).begin ( ), extendedAutomaton.getFinalStates ( ).end ( ),
110 std::inserter ( statesToEliminate, statesToEliminate.
begin ( ) ) );
112 for (
const StateType& state : statesToEliminate ) {
113 extendedAutomaton = eliminateState ( extendedAutomaton, state );
118 for (
const auto& tr : extendedAutomaton.getTransitions ( ) )
119 for (
const StateType& targetState : tr.second )
125template <
class SymbolType,
class StateType >
127 if ( transitions.empty ( ) )
129 if ( transitions.size ( ) == 1 )
130 return transitions.at ( 0 ).first.first;
139template <
class SymbolType,
class StateType >
146 newAutomaton.removeState ( state );
157 transitionType incoming;
158 transitionType outgoing;
163 for (
const auto& transition :
automaton.getTransitions ( ) ) {
164 for (
const StateType& target : transition.second ) {
167 const bool is_source = std::find ( src_states.
begin ( ), src_states.
end ( ), state ) != src_states.
end ( );
168 const bool is_target = target == state;
170 if ( is_source && is_target ) {
172 prev_loop.insert ( transition.first.second.begin ( ), transition.first.second.end ( ) );
173 }
else if ( ! is_source && is_target ) {
174 incoming.push_back (
ext::make_pair ( transition.first, target ) );
175 prev_incoming.insert ( transition.first.second.begin ( ), transition.first.second.end ( ) );
176 }
else if ( is_source && ! is_target ) {
177 outgoing.push_back (
ext::make_pair ( transition.first, target ) );
179 newAutomaton.addTransition ( transition.first.first, transition.first.second, target );
185 const edgeLabelType rte_loop = createAlternation ( loop );
186 const edgeLabelType rte_incoming = createAlternation ( incoming );
191 for (
const auto& transition : outgoing ) {
194 const StateType& tr_target = transition.second;
199 prevStates.insert ( prev_loop.
begin ( ), prev_loop.
end ( ) );
200 prevStates.insert ( prev_incoming.
begin ( ), prev_incoming.
end ( ) );
201 prevStates.insert ( tr_src_states.
begin ( ), tr_src_states.
end ( ) );
202 prevStates.erase ( state );
209 rte_incoming.getStructure ( ), stateSymbol ),
230template <
class SymbolType,
class StateType >
239 automaton.addTransition ( expr, { state }, f );
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: ExtendedNFTA.h:75
Definition: ToRTEStateElimination.h:52
static rte::FormalRTE< ext::variant< SymbolType, StateType > > convert(const T &automaton)
Definition: ToRTEStateElimination.h:98
Definition: ranked_symbol.hpp:20
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
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
static rte::FormalRTE< SymbolType > optimize(const rte::FormalRTE< SymbolType > &rte)
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
Definition: ToGrammar.h:31
T createUnique(T object, const Alphabets &... alphabets)
Definition: createUnique.hpp:46
Definition: converterCommon.hpp:8
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ToFTAGlushkov.h:22