Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
MultiInitialStateEpsilonNFA.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <ostream>
27
28#include <alib/multimap>
29#include <alib/set>
30
31#include <core/components.hpp>
33
37
39
41
42#include <core/normalize.hpp>
45
46#include "EpsilonNFA.h"
48#include "NFA.h"
49#include "DFA.h"
50
51namespace automaton {
52
53class InputAlphabet;
54class States;
55class FinalStates;
56class InitialStates;
57
74template < class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType >
75class MultiInitialStateEpsilonNFA final : public core::Components < MultiInitialStateEpsilonNFA < SymbolTypeT, StateTypeT >, ext::set < SymbolTypeT >, component::Set, InputAlphabet, ext::set < StateTypeT >, component::Set, std::tuple < States, InitialStates, FinalStates > > {
76public:
77 typedef SymbolTypeT SymbolType;
78 typedef StateTypeT StateType;
79
80private:
85
86public:
90 explicit MultiInitialStateEpsilonNFA ( );
91
101
102 /*
103 * \brief Creates a new instance of Nondeterministic finite automaton based on the Deterministic finite automaton.
104 *
105 * \param other the Nondeterministic finite automaton with multiple initial states
106 */
108
109 /*
110 * \brief Creates a new instance of Nondeterministic finite automaton based on the Deterministic finite automaton.
111 *
112 * \param other the Nondeterministic finite automaton with multiple initial states
113 */
115
116 /*
117 * \brief Creates a new instance of Nondeterministic finite automaton based on the Deterministic finite automaton.
118 *
119 * \param other the Nondeterministic finite automaton
120 */
122
123 /*
124 * \brief creates a new instance of the automaton based on the deterministic finite automaton.
125 *
126 * \param other the deterministic finite automaton
127 */
129
136 return this->template accessComponent < InitialStates > ( ).get ( );
137 }
138
145 return std::move ( this->template accessComponent < InitialStates > ( ).get ( ) );
146 }
147
155 bool addInitialState ( StateType state ) {
156 return this->template accessComponent < InitialStates > ( ).add ( std::move ( state ) );
157 }
158
165 this->template accessComponent < InitialStates > ( ).set ( std::move ( states ) );
166 }
167
175 void removeInitialState ( const StateType & state ) {
176 this->template accessComponent < InitialStates > ( ).remove ( state );
177 }
178
184 const ext::set < StateType > & getStates ( ) const & {
185 return this->template accessComponent < States > ( ).get ( );
186 }
187
194 return std::move ( this->template accessComponent < States > ( ).get ( ) );
195 }
196
204 bool addState ( StateType state ) {
205 return this->template accessComponent < States > ( ).add ( std::move ( state ) );
206 }
207
214 this->template accessComponent < States > ( ).set ( std::move ( states ) );
215 }
216
224 void removeState ( const StateType & state ) {
225 this->template accessComponent < States > ( ).remove ( state );
226 }
227
234 return this->template accessComponent < FinalStates > ( ).get ( );
235 }
236
243 return std::move ( this->template accessComponent < FinalStates > ( ).get ( ) );
244 }
245
253 bool addFinalState ( StateType state ) {
254 return this->template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
255 }
256
263 this->template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
264 }
265
273 void removeFinalState ( const StateType & state ) {
274 this->template accessComponent < FinalStates > ( ).remove ( state );
275 }
276
283 return this->template accessComponent < InputAlphabet > ( ).get ( );
284 }
285
292 return std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) );
293 }
294
302 bool addInputSymbol ( SymbolType symbol ) {
303 return this->template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
304 }
305
312 this->template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
313 }
314
321 this->template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
322 }
323
331 void removeInputSymbol ( const SymbolType & symbol ) {
332 this->template accessComponent < InputAlphabet > ( ).remove ( symbol );
333 }
334
349
363 bool addTransition ( StateType from, SymbolType input, StateType to );
364
377 bool addTransition ( StateType from, StateType to );
378
393
405 bool removeTransition ( const StateType & from, const SymbolType & input, const StateType & to );
406
417 bool removeTransition ( const StateType & from, const StateType & to );
418
425
431 ext::multimap < ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > && getTransitions ( ) &&;
432
438 ext::multimap < StateType, StateType > getEpsilonTransitions ( ) const;
439
445 ext::multimap < ext::pair < StateType, SymbolType >, StateType > getSymbolTransitions ( ) const;
446
454 ext::multimap < ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > getTransitionsFromState ( const StateType & from ) const;
455
463 ext::multimap < StateType, StateType > getEpsilonTransitionsFromState ( const StateType & from ) const;
464
472 ext::multimap < ext::pair < StateType, SymbolType >, StateType > getSymbolTransitionsFromState ( const StateType & from ) const;
473
481 ext::multimap < ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > getTransitionsToState ( const StateType & to ) const;
482
490 ext::multimap < StateType, StateType > getEpsilonTransitionsToState ( const StateType & to ) const;
491
499 ext::multimap < ext::pair < StateType, SymbolType >, StateType > getSymbolTransitionsToState ( const StateType & to ) const;
500
506 bool isEpsilonFree ( ) const;
507
517 bool isDeterministic ( ) const;
518
528 bool isTotal ( ) const;
529
537 auto operator <=> ( const MultiInitialStateEpsilonNFA & other ) const {
538 return std::tie ( getStates ( ), getInputAlphabet ( ), getInitialStates ( ), getFinalStates ( ), transitions ) <=> std::tie ( other.getStates ( ), other.getInputAlphabet ( ), other.getInitialStates ( ), other.getFinalStates ( ), other.getTransitions ( ) );
539 }
540
548 bool operator == ( const MultiInitialStateEpsilonNFA & other ) const {
549 return std::tie ( getStates ( ), getInputAlphabet ( ), getInitialStates ( ), getFinalStates ( ), transitions ) == std::tie ( other.getStates ( ), other.getInputAlphabet ( ), other.getInitialStates ( ), other.getFinalStates ( ), other.getTransitions ( ) );
550 }
551
561 return out << "(MultiInitialStateEpsilonNFA"
562 << " states = " << instance.getStates ( )
563 << " inputAlphabet = " << instance.getInputAlphabet ( )
564 << " initialState = " << instance.getInitialStates ( )
565 << " finalStates = " << instance.getFinalStates ( )
566 << " transitions = " << instance.getTransitions ( )
567 << ")";
568 }
569};
570
576template < class T >
577class isMultiInitialStateEpsilonNFA_impl : public std::false_type {};
578
587template < class SymbolType, class StateType >
589
595template < class T >
597
598template<class SymbolType, class StateType >
599MultiInitialStateEpsilonNFA < SymbolType, StateType >::MultiInitialStateEpsilonNFA ( ext::set < StateType > states, ext::set < SymbolType > inputAlphabet, ext::set < StateType > initialStates, ext::set < StateType > finalStates ) : core::Components < MultiInitialStateEpsilonNFA, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > ( std::move ( inputAlphabet ), std::move ( states ), std::move ( initialStates ), std::move ( finalStates ) ) {
600}
601
602template<class SymbolType, class StateType >
604}
605
606template<class SymbolType, class StateType >
607MultiInitialStateEpsilonNFA < SymbolType, StateType >::MultiInitialStateEpsilonNFA ( const EpsilonNFA < SymbolType, StateType > & other ) : MultiInitialStateEpsilonNFA ( other.getStates ( ), other.getInputAlphabet ( ), { other.getInitialState ( ) }, other.getFinalStates ( ) ) {
608 transitions = other.getTransitions ( );
609}
610
611template<class SymbolType, class StateType >
612MultiInitialStateEpsilonNFA < SymbolType, StateType >::MultiInitialStateEpsilonNFA ( const MultiInitialStateNFA < SymbolType, StateType > & other ) : MultiInitialStateEpsilonNFA ( other.getStates ( ), other.getInputAlphabet ( ), other.getInitialStates ( ), other.getFinalStates ( ) ) {
613 for ( const auto & transition : other.getTransitions ( ) ) {
615 transitions.insert ( key, transition.second );
616 }
617}
618
619template<class SymbolType, class StateType >
620MultiInitialStateEpsilonNFA < SymbolType, StateType >::MultiInitialStateEpsilonNFA ( const NFA < SymbolType, StateType > & other ) : MultiInitialStateEpsilonNFA ( other.getStates ( ), other.getInputAlphabet ( ), { other.getInitialState ( ) }, other.getFinalStates ( ) ) {
621 for ( const auto & transition : other.getTransitions ( ) ) {
623 transitions.insert ( key, transition.second );
624 }
625}
626
627template<class SymbolType, class StateType >
628MultiInitialStateEpsilonNFA < SymbolType, StateType >::MultiInitialStateEpsilonNFA ( const DFA < SymbolType, StateType > & other ) : MultiInitialStateEpsilonNFA ( other.getStates ( ), other.getInputAlphabet ( ), { other.getInitialState ( ) }, other.getFinalStates ( ) ) {
629 for ( const auto & transition : other.getTransitions ( ) ) {
631 transitions.insert( key, transition.second );
632 }
633}
634
635template<class SymbolType, class StateType >
637 if ( ! getStates ( ).contains ( from ) )
638 throw AutomatonException ( "State \"" + ext::to_string ( from ) + "\" doesn't exist." );
639
640 if ( ! input.is_epsilon ( ) && !getInputAlphabet ( ).contains ( input ) )
641 throw AutomatonException ( "Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist." );
642
643 if ( ! getStates ( ).contains ( to ) )
644 throw AutomatonException ( "State \"" + ext::to_string ( to ) + "\" doesn't exist." );
645
646 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input ) );
647 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input ) );
648 auto iter = std::lower_bound ( lower_bound, upper_bound, to, [ ] ( const auto & transition, const auto & target ) { return transition.second < target; } );
649 if ( iter != upper_bound && to >= iter->second )
650 return false;
651
652 ext::pair < StateType, common::symbol_or_epsilon < SymbolType > > key = ext::make_pair ( std::move ( from ), std::move ( input ) );
653 transitions.insert ( iter, std::make_pair ( std::move ( key ), std::move ( to ) ) );
654 return true;
655}
656
657template<class SymbolType, class StateType >
659 common::symbol_or_epsilon < SymbolType > inputVariant ( std::move ( input ) );
660
661 return addTransition ( std::move ( from ), std::move ( inputVariant ), std::move ( to ) );
662}
663
664template<class SymbolType, class StateType >
666 auto inputVariant = common::symbol_or_epsilon < SymbolType > ( );
667
668 return addTransition ( std::move ( from ), std::move ( inputVariant ), std::move ( to ) );
669}
670
671template<class SymbolType, class StateType >
673 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input ) );
674 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input ) );
675 auto iter = std::find_if ( lower_bound, upper_bound, [ & ] ( const auto & transition ) { return transition.second == to; } );
676 if ( iter == upper_bound )
677 return false;
678
679 transitions.erase ( iter );
680 return true;
681}
682
683template<class SymbolType, class StateType >
685 common::symbol_or_epsilon < SymbolType > inputVariant ( std::move ( input ) );
686
687 return addTransition ( std::move ( from ), std::move ( inputVariant ), std::move ( to ) );
688}
689
690template<class SymbolType, class StateType >
692 auto inputVariant = common::symbol_or_epsilon < SymbolType > ( );
693
694 return addTransition ( std::move ( from ), std::move ( inputVariant ), std::move ( to ) );
695}
696
697template<class SymbolType, class StateType >
699 return transitions;
700}
701
702template<class SymbolType, class StateType >
704 return std::move ( transitions );
705}
706
707template<class SymbolType, class StateType >
710
711 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
712 if ( transition.first.second.is_epsilon ( ) )
713 result.insert ( transition.first.first, transition.second );
714
715 return result;
716}
717
718template<class SymbolType, class StateType >
721
722 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
723 if ( ! transition.first.second.is_epsilon ( ) )
724 result.insert ( ext::make_pair ( transition.first.first, transition.first.second.getSymbol ( ) ), transition.second );
725
726 return result;
727}
728
729template<class SymbolType, class StateType >
731 if ( ! getStates ( ).contains ( from ) )
732 throw AutomatonException ( "State \"" + ext::to_string ( from ) + "\" doesn't exist" );
733
735
736 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
737 if ( transition.first.first == from )
738 transitionsFromState.insert ( transition );
739
740 return transitionsFromState;
741}
742
743template<class SymbolType, class StateType >
745 if ( ! getStates ( ).contains ( from ) )
746 throw AutomatonException ( "State \"" + ext::to_string ( from ) + "\" doesn't exist" );
747
750
751 for ( const auto & transition : transitions.equal_range ( key ) )
752 res.insert ( transition.first.first, transition.second );
753
754 return res;
755}
756
757template<class SymbolType, class StateType >
759 if ( ! getStates ( ).contains ( from ) )
760 throw AutomatonException ( "State \"" + ext::to_string ( from ) + "\" doesn't exist" );
761
763
764 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
765 if ( ( transition.first.first == from ) && ! transition.first.second.is_epsilon ( ) )
766 transitionsFromState.insert ( ext::make_pair ( transition.first.first, transition.first.second.getSymbol ( ) ), transition.second );
767
768 return transitionsFromState;
769}
770
771template<class SymbolType, class StateType >
773 if ( ! getStates ( ).contains ( to ) )
774 throw AutomatonException ( "State \"" + ext::to_string ( to ) + "\" doesn't exist" );
775
777
778 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
779 if ( transition.second == to )
780 transitionsToState.insert ( transition.first, to );
781
782 return transitionsToState;
783}
784
785template<class SymbolType, class StateType >
787 if ( ! getStates ( ).contains ( to ) )
788 throw AutomatonException ( "State \"" + ext::to_string ( to ) + "\" doesn't exist" );
789
791
792 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
793 if ( transition.second == to && transition.first.second.is_epsilon ( ) )
794 transitionsToState.insert ( transition.first.first, to );
795
796 return transitionsToState;
797}
798
799template<class SymbolType, class StateType >
801 if ( ! getStates ( ).contains ( to ) )
802 throw AutomatonException ( "State \"" + ext::to_string ( to ) + "\" doesn't exist" );
803
805
806 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
807 if ( transition.second == to && ! transition.first.second.is_epsilon ( ) )
808 transitionsToState.insert ( ext::make_pair ( transition.first.first, transition.first.second.getSymbol ( ) ), to );
809
810 return transitionsToState;
811}
812
813template<class SymbolType, class StateType >
815 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : transitions )
816 if ( transition.first.second.is_epsilon ( ) )
817 return false;
818
819 return true;
820}
821
822template<class SymbolType, class StateType >
824 if ( transitions.empty ( ) )
825 return true;
826
827 for ( auto iter = transitions.begin ( ); std::next ( iter ) != transitions.end ( ); ++ iter )
828 if ( iter->first == std::next ( iter )->first )
829 return false;
830
831 return isEpsilonFree ( ) && getInitialStates ( ).size ( ) == 1;
832}
833
834template<class SymbolType, class StateType >
836 return isDeterministic ( ) && transitions.size ( ) == getInputAlphabet ( ).size ( ) * getStates ( ).size ( );
837}
838
839} /* namespace automaton */
840
841namespace core {
842
849template<class SymbolType, class StateType >
850class SetConstraint< automaton::MultiInitialStateEpsilonNFA < SymbolType, StateType >, SymbolType, automaton::InputAlphabet > {
851public:
861 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : automaton.getTransitions ( ) )
862 if ( ! transition.first.second.is_epsilon ( ) && ( transition.first.second.getSymbol ( ) == symbol ) )
863 return true;
864
865 return false;
866 }
867
877 return true;
878 }
879
887 }
888};
889
896template<class SymbolType, class StateType >
897class SetConstraint< automaton::MultiInitialStateEpsilonNFA < SymbolType, StateType >, StateType, automaton::States > {
898public:
908 if ( automaton.getInitialStates ( ).contains ( state ) )
909 return true;
910
911 if ( automaton.getFinalStates ( ).contains ( state ) )
912 return true;
913
914 for ( const std::pair < const ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > & transition : automaton.getTransitions ( ) )
915 if ( ( transition.first.first == state ) || transition.second == state )
916 return true;
917
918 return false;
919 }
920
930 return true;
931 }
932
940 }
941};
942
949template<class SymbolType, class StateType >
950class SetConstraint< automaton::MultiInitialStateEpsilonNFA < SymbolType, StateType >, StateType, automaton::FinalStates > {
951public:
961 return false;
962 }
963
973 return automaton.template accessComponent < automaton::States > ( ).get ( ).contains ( state );
974 }
975
983 }
984};
985
992template<class SymbolType, class StateType >
993class SetConstraint< automaton::MultiInitialStateEpsilonNFA < SymbolType, StateType >, StateType, automaton::InitialStates > {
994public:
1004 return false;
1005 }
1006
1016 return automaton.template accessComponent < automaton::States > ( ).get ( ).contains ( state );
1017 }
1018
1026 }
1027};
1028
1034template<class SymbolType, class StateType >
1035struct normalize < automaton::MultiInitialStateEpsilonNFA < SymbolType, StateType > > {
1037 ext::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getInputAlphabet ( ) );
1038 ext::set < DefaultStateType > states = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getStates ( ) );
1039 ext::set < DefaultStateType > initialStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getInitialStates ( ) );
1040 ext::set < DefaultStateType > finalStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getFinalStates ( ) );
1041
1042 automaton::MultiInitialStateEpsilonNFA < > res ( std::move ( states ), std::move ( alphabet ), std::move ( initialStates ), std::move ( finalStates ) );
1043
1044 for ( std::pair < ext::pair < StateType, common::symbol_or_epsilon < SymbolType > >, StateType > && transition : ext::make_mover ( std::move ( value ).getTransitions ( ) ) ) {
1045 DefaultStateType from = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) );
1047 DefaultStateType target = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.second ) );
1048
1049 res.addTransition ( std::move ( from ), std::move ( input ), std::move ( target ) );
1050 }
1051
1052 return res;
1053 }
1054};
1055
1056} /* namespace core */
1057
1058extern template class automaton::MultiInitialStateEpsilonNFA < >;
1059
static ext::set< DefaultSymbolType > normalizeAlphabet(ext::set< SymbolType > &&symbols)
Definition: SymbolNormalize.h:50
Definition: AutomatonException.h:15
static common::symbol_or_epsilon< DefaultSymbolType > normalizeSymbolEpsilon(common::symbol_or_epsilon< SymbolType > &&symbol)
Definition: AutomatonNormalize.h:81
static DefaultStateType normalizeState(StateType &&state)
Definition: AutomatonNormalize.h:76
static ext::multiset< DefaultStateType > normalizeStates(ext::multiset< StateType > &&states)
Definition: AutomatonNormalize.h:49
Deterministic finite automaton. Accepts regular languages.
Definition: DFA.h:71
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: MultiInitialStateEpsilonNFA.h:75
ext::set< StateType > && getInitialStates() &&
Definition: MultiInitialStateEpsilonNFA.h:144
void removeState(const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:224
bool addFinalState(StateType state)
Definition: MultiInitialStateEpsilonNFA.h:253
bool removeTransition(StateType from, common::symbol_or_epsilon< SymbolType > input, StateType to)
Removes a transition to the automaton.
Definition: MultiInitialStateEpsilonNFA.h:672
friend ext::ostream & operator<<(ext::ostream &out, const MultiInitialStateEpsilonNFA &instance)
Definition: MultiInitialStateEpsilonNFA.h:560
bool addInputSymbol(SymbolType symbol)
Definition: MultiInitialStateEpsilonNFA.h:302
const ext::set< SymbolType > & getInputAlphabet() const &
Definition: MultiInitialStateEpsilonNFA.h:282
ext::multimap< StateType, StateType > getEpsilonTransitionsToState(const StateType &to) const
Definition: MultiInitialStateEpsilonNFA.h:786
ext::set< StateType > && getFinalStates() &&
Definition: MultiInitialStateEpsilonNFA.h:242
bool isDeterministic() const
Determines whether the automaton is deterministic.
Definition: MultiInitialStateEpsilonNFA.h:823
MultiInitialStateEpsilonNFA()
Creates a new instance of the automaton with a concrete initial state.
Definition: MultiInitialStateEpsilonNFA.h:603
bool isEpsilonFree() const
Determines whether the automaton is without epsilon transitions.
Definition: MultiInitialStateEpsilonNFA.h:814
ext::multimap< ext::pair< StateType, SymbolType >, StateType > getSymbolTransitionsFromState(const StateType &from) const
Definition: MultiInitialStateEpsilonNFA.h:758
const ext::set< StateType > & getInitialStates() const &
Definition: MultiInitialStateEpsilonNFA.h:135
bool addInitialState(StateType state)
Definition: MultiInitialStateEpsilonNFA.h:155
void setInputAlphabet(ext::set< SymbolType > symbols)
Definition: MultiInitialStateEpsilonNFA.h:320
void setFinalStates(ext::set< StateType > states)
Definition: MultiInitialStateEpsilonNFA.h:262
ext::multimap< StateType, StateType > getEpsilonTransitionsFromState(const StateType &from) const
Definition: MultiInitialStateEpsilonNFA.h:744
void removeInitialState(const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:175
ext::set< StateType > && getStates() &&
Definition: MultiInitialStateEpsilonNFA.h:193
const ext::set< StateType > & getStates() const &
Definition: MultiInitialStateEpsilonNFA.h:184
bool addState(StateType state)
Definition: MultiInitialStateEpsilonNFA.h:204
void removeFinalState(const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:273
ext::multimap< ext::pair< StateType, SymbolType >, StateType > getSymbolTransitionsToState(const StateType &to) const
Definition: MultiInitialStateEpsilonNFA.h:800
ext::multimap< StateType, StateType > getEpsilonTransitions() const
Definition: MultiInitialStateEpsilonNFA.h:708
void addInputSymbols(ext::set< SymbolType > symbols)
Definition: MultiInitialStateEpsilonNFA.h:311
void setStates(ext::set< StateType > states)
Definition: MultiInitialStateEpsilonNFA.h:213
bool addTransition(StateType from, common::symbol_or_epsilon< SymbolType > input, StateType to)
Add a transition to the automaton.
Definition: MultiInitialStateEpsilonNFA.h:636
ext::multimap< ext::pair< StateType, SymbolType >, StateType > getSymbolTransitions() const
Definition: MultiInitialStateEpsilonNFA.h:719
void setInitialStates(ext::set< StateType > states)
Definition: MultiInitialStateEpsilonNFA.h:164
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > & getTransitions() const &
Definition: MultiInitialStateEpsilonNFA.h:698
ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > getTransitionsToState(const StateType &to) const
Definition: MultiInitialStateEpsilonNFA.h:772
ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > getTransitionsFromState(const StateType &from) const
Definition: MultiInitialStateEpsilonNFA.h:730
bool isTotal() const
Determines whether the automaton is total deterministic.
Definition: MultiInitialStateEpsilonNFA.h:835
SymbolTypeT SymbolType
Definition: MultiInitialStateEpsilonNFA.h:77
const ext::set< StateType > & getFinalStates() const &
Definition: MultiInitialStateEpsilonNFA.h:233
bool operator==(const MultiInitialStateEpsilonNFA &other) const
Definition: MultiInitialStateEpsilonNFA.h:548
StateTypeT StateType
Definition: MultiInitialStateEpsilonNFA.h:78
void removeInputSymbol(const SymbolType &symbol)
Definition: MultiInitialStateEpsilonNFA.h:331
ext::set< SymbolType > && getInputAlphabet() &&
Definition: MultiInitialStateEpsilonNFA.h:291
Nondeterministic finite automaton with multiple initial states. Accepts regular languages.
Definition: MultiInitialStateNFA.h:69
Nondeterministic finite automaton. Accepts regular languages.
Definition: NFA.h:66
Definition: MultiInitialStateEpsilonNFA.h:577
Definition: symbol_or_epsilon.hpp:24
Definition: components.hpp:181
static bool used(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &automaton, const SymbolType &symbol)
Definition: MultiInitialStateEpsilonNFA.h:860
static void valid(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const SymbolType &)
Definition: MultiInitialStateEpsilonNFA.h:886
static bool available(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const SymbolType &)
Definition: MultiInitialStateEpsilonNFA.h:876
static void valid(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:939
static bool available(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:929
static bool used(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &automaton, const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:907
static bool available(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &automaton, const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:1015
static void valid(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:1025
static bool used(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:1003
static bool used(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:960
static bool available(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &automaton, const StateType &state)
Definition: MultiInitialStateEpsilonNFA.h:972
static void valid(const automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &, const StateType &)
Definition: MultiInitialStateEpsilonNFA.h:982
Definition: setComponents.hpp:26
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: ostream.h:14
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: set.hpp:44
Definition: Object.h:16
Definition: BarSymbol.cpp:12
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
return res
Definition: MinimizeByPartitioning.h:145
for(const StateType &state :fsm.getStates()) renamingData.insert(std Rename::RenamedAutomaton< T > result(renamingData.at(fsm.getInitialState()))
Definition: Rename.h:253
Definition: ToGrammar.h:31
constexpr bool isMultiInitialStateEpsilonNFA
Definition: MultiInitialStateEpsilonNFA.h:596
Definition: Permutation.hpp:18
Definition: normalize.hpp:10
Definition: sigHandler.cpp:20
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
reference_mover< T > make_mover(T &param)
Move adaptor construction function specialized to lvalue reference parameter.
Definition: iterator.hpp:468
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
static automaton::MultiInitialStateEpsilonNFA< > eval(automaton::MultiInitialStateEpsilonNFA< SymbolType, StateType > &&value)
Definition: MultiInitialStateEpsilonNFA.h:1036
Definition: normalize.hpp:13