Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
InputDrivenNPDA.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 <ext/algorithm>
29#include <ext/iterator>
30
31#include <alib/multimap>
32#include <alib/set>
33#include <alib/vector>
34
35#include <core/components.hpp>
36
39
41
42#include <core/normalize.hpp>
45
46namespace automaton {
47
48class InputAlphabet;
49class PushdownStoreAlphabet;
50class InitialSymbol;
51class States;
52class FinalStates;
53class InitialState;
54
78template < class InputSymbolTypeT = DefaultSymbolType, class PushdownStoreSymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType >
79class InputDrivenNPDA final : public core::Components < InputDrivenNPDA < InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >, ext::set < InputSymbolTypeT >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolTypeT >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolTypeT, component::Value, InitialSymbol, ext::set < StateTypeT >, component::Set, std::tuple < States, FinalStates >, StateTypeT, component::Value, InitialState > {
80public:
81 typedef InputSymbolTypeT InputSymbolType;
82 typedef PushdownStoreSymbolTypeT PushdownStoreSymbolType;
83 typedef StateTypeT StateType;
84
85private:
90
95
96 /*
97 * Helper function to validate pop and push pushdown store operaion maped to input symbol.
98 *
99 * \param input the input symbol
100 * \param pop the vector of symbols to be poped
101 * \param push the vector of symbols to be pushed
102 */
103 void checkPushdownStoreOperation ( const InputSymbolType & input, const ext::vector < PushdownStoreSymbolType > & pop, const ext::vector < PushdownStoreSymbolType > & push );
104
105public:
116 explicit InputDrivenNPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates );
117
124 explicit InputDrivenNPDA ( StateType initialState, PushdownStoreSymbolType initialPushdownSymbol );
125
131 const StateType & getInitialState ( ) const & {
132 return this-> template accessComponent < InitialState > ( ).get ( );
133 }
134
141 return std::move ( this-> template accessComponent < InitialState > ( ).get ( ) );
142 }
143
151 bool setInitialState ( StateType state ) {
152 return this-> template accessComponent < InitialState > ( ).set ( std::move ( state ) );
153 }
154
160 const ext::set < StateType > & getStates ( ) const & {
161 return this-> template accessComponent < States > ( ).get ( );
162 }
163
170 return std::move ( this-> template accessComponent < States > ( ).get ( ) );
171 }
172
180 bool addState ( StateType state ) {
181 return this-> template accessComponent < States > ( ).add ( std::move ( state ) );
182 }
183
190 this-> template accessComponent < States > ( ).set ( std::move ( states ) );
191 }
192
200 void removeState ( const StateType & state ) {
201 this-> template accessComponent < States > ( ).remove ( state );
202 }
203
210 return this-> template accessComponent < FinalStates > ( ).get ( );
211 }
212
219 return std::move ( this-> template accessComponent < FinalStates > ( ).get ( ) );
220 }
221
229 bool addFinalState ( StateType state ) {
230 return this-> template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
231 }
232
239 this-> template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
240 }
241
249 void removeFinalState ( const StateType & state ) {
250 this-> template accessComponent < FinalStates > ( ).remove ( state );
251 }
252
259 return this->template accessComponent < PushdownStoreAlphabet > ( ).get ( );
260 }
261
268 return std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) );
269 }
270
279 return this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbol ) );
280 }
281
288 this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbols ) );
289 }
290
297 this->template accessComponent < PushdownStoreAlphabet > ( ).set ( std::move ( symbols ) );
298 }
299
308 this->template accessComponent < PushdownStoreAlphabet > ( ).remove ( symbol );
309 }
310
317 return this->template accessComponent < InitialSymbol > ( ).get ( );
318 }
319
326 return std::move ( this->template accessComponent < InitialSymbol > ( ).get ( ) );
327 }
328
337 return this->template accessComponent < InitialSymbol > ( ).set ( std::move ( symbol ) );
338 }
339
346 return this-> template accessComponent < InputAlphabet > ( ).get ( );
347 }
348
355 return std::move ( this-> template accessComponent < InputAlphabet > ( ).get ( ) );
356 }
357
366 return this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
367 }
368
375 this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
376 }
377
384 this-> template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
385 }
386
394 void removeInputSymbol ( const InputSymbolType & symbol ) {
395 this-> template accessComponent < InputAlphabet > ( ).remove ( symbol );
396 }
397
409
417
424 bool clearPushdownStoreOperation ( const InputSymbolType & input );
425
432
438 ext::map < InputSymbolType, ext::pair < ext::vector < PushdownStoreSymbolType >, ext::vector < PushdownStoreSymbolType > > > && getPushdownStoreOperations ( ) &&;
439
453 bool addTransition ( StateType from, InputSymbolType input, StateType to );
454
466 bool removeTransition ( const StateType & from, const InputSymbolType & input, const StateType & to );
467
473 const ext::multimap < ext::pair < StateType, InputSymbolType >, StateType > & getTransitions ( ) const &;
474
480 ext::multimap < ext::pair < StateType, InputSymbolType >, StateType > && getTransitions ( ) &&;
481
489 ext::multimap < ext::pair < StateType, InputSymbolType >, StateType > getTransitionsFromState ( const StateType & from ) const;
490
498 ext::multimap < ext::pair < StateType, InputSymbolType >, StateType > getTransitionsToState ( const StateType & to ) const;
499
508 bool isDeterministic ( ) const;
509
517 auto operator <=> ( const InputDrivenNPDA & other ) const {
518 return std::tie(getStates(), getInputAlphabet(), getInitialState(), getFinalStates(), getPushdownStoreAlphabet(), getInitialSymbol(), getPushdownStoreOperations(), transitions) <=> std::tie(other.getStates(), other.getInputAlphabet(), other.getInitialState(), other.getFinalStates(), other.getPushdownStoreAlphabet(), other.getInitialSymbol(), other.getPushdownStoreOperations(), other.transitions);
519 }
520
528 bool operator == ( const InputDrivenNPDA & other ) const {
530 }
531
540 friend ext::ostream & operator << ( ext::ostream & out, const InputDrivenNPDA & instance ) {
541 return out << "(InputDrivenNPDA"
542 << " states = " << instance.getStates ( )
543 << " inputAlphabet = " << instance.getInputAlphabet ( )
544 << " initialState = " << instance.getInitialState ( )
545 << " finalStates = " << instance.getFinalStates ( )
546 << " pushdownStoreAlphabet = " << instance.getPushdownStoreAlphabet ( )
547 << " initialSymbol = " << instance.getInitialSymbol ( )
548 << " transitions = " << instance.getTransitions ( )
549 << " inputSymbolToPushdownStoreOperation = " << instance.getPushdownStoreOperations ( )
550 << ")";
551 }
552};
553
554template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
555InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::InputDrivenNPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates ) : core::Components < InputDrivenNPDA, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > ( std::move ( inputAlphabet ), std::move ( pushdownStoreAlphabet ), std::move ( initialSymbol ), std::move ( states ), std::move ( finalStates ), std::move ( initialState ) ) {
556}
557
558template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
560}
561
562template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
563void InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::checkPushdownStoreOperation(const InputSymbolType& input, const ext::vector<PushdownStoreSymbolType>& pop, const ext::vector<PushdownStoreSymbolType>& push) {
564 if (! getInputAlphabet().count(input)) {
565 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
566 }
567
568 for(const PushdownStoreSymbolType& popSymbol : pop) {
569 if (! getPushdownStoreAlphabet().count(popSymbol)) {
570 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( popSymbol ) + "\" doesn't exist.");
571 }
572 }
573
574 for(const PushdownStoreSymbolType& pushSymbol : push) {
575 if (! getPushdownStoreAlphabet().count(pushSymbol)) {
576 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( pushSymbol ) + "\" doesn't exist.");
577 }
578 }
579}
580
581template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
583 checkPushdownStoreOperation(input, pop, push);
584 return inputSymbolToPushdownStoreOperation.insert ( input, ext::make_pair( pop, push ) ).second;
585}
586
587template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
590 std::set_difference(getInputAlphabet().begin(), getInputAlphabet().end(), ext::key_begin(operations), ext::key_end(operations), std::inserter(removed, removed.end()));
591
592 for(const InputSymbolType& removedSymbol : removed) {
593 clearPushdownStoreOperation(removedSymbol);
594 }
595
596 for(const auto& added : operations) {
597 checkPushdownStoreOperation(added.first, added.second.first, added.second.second);
598 }
599
600 inputSymbolToPushdownStoreOperation = std::move(operations);
601}
602
603template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
605 for ( const std::pair < const ext::pair < StateType, InputSymbolType >, StateType > & transition : transitions) {
606 if (transition.first.second == input)
607 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" is used.");
608 }
609
610 return inputSymbolToPushdownStoreOperation.erase(input);
611}
612
613template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
615 return inputSymbolToPushdownStoreOperation;
616}
617
618template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
620 return std::move ( inputSymbolToPushdownStoreOperation );
621}
622
623template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
625 if (! getStates().count(from))
626 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist.");
627
628 if (! getInputAlphabet().count(input))
629 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
630
631 if (! getPushdownStoreOperations().count(input))
632 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
633
634 if (! getStates().count(to))
635 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist.");
636
637 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input ) );
638 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input ) );
639 auto iter = std::lower_bound ( lower_bound, upper_bound, to, [ ] ( const auto & transition, const auto & target ) { return transition.second < target; } );
640 if ( iter != upper_bound && to >= iter->second )
641 return false;
642
643 ext::pair < StateType, InputSymbolType > key = ext::make_pair ( std::move ( from ), std::move ( input ) );
644 transitions.insert ( iter, std::make_pair ( std::move ( key ), std::move ( to ) ) );
645 return true;
646}
647
648template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
650 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input ) );
651 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input ) );
652 auto iter = std::find_if ( lower_bound, upper_bound, [ & ] ( const auto & transition ) { return transition.second == to; } );
653 if ( iter == upper_bound )
654 return false;
655
656 transitions.erase ( iter );
657 return true;
658}
659
660template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
662 return transitions;
663}
664
665template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
667 return std::move ( transitions );
668}
669
670template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
672 if (! getStates().count(from))
673 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist");
674
676 for ( const std::pair < const ext::pair < StateType, InputSymbolType >, StateType > & transition : transitions ) {
677 if (transition.first.first == from) {
678 transitionsFromState.insert ( transition.first, transition.second );
679 }
680 }
681
682 return transitionsFromState;
683}
684
685template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
687 if (! getStates().count(to))
688 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist");
689
691 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType >& transition : transitions) {
692 if (transition.second == to ) {
693 transitionsToState.insert ( transition.first, transition.second );
694 }
695 }
696
697 return transitionsToState;
698}
699
700template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
702 if ( transitions.empty ( ) )
703 return true;
704
705 for ( auto iter = transitions.begin ( ); std::next ( iter ) != transitions.end ( ); ++ iter )
706 if ( iter->first == std::next ( iter )->first )
707 return false;
708
709 return true;
710}
711
712} /* namespace automaton */
713
714namespace core {
715
723template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
724class SetConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, InputSymbolType, automaton::InputAlphabet > {
725public:
735 for ( const std::pair < const ext::pair < StateType, InputSymbolType >, StateType > & transition : automaton.getTransitions ( ) )
736 if (transition.first.second == symbol)
737 return true;
738
739 return false;
740 }
741
751 return true;
752 }
753
761 }
762};
763
771template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
772class SetConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::PushdownStoreAlphabet > {
773public:
782 static bool used ( const automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const PushdownStoreSymbolType & symbol ) {
783 for (const auto& pushdownStoreOperation : automaton.getPushdownStoreOperations()) {
784 if (std::find(pushdownStoreOperation.second.first.begin(), pushdownStoreOperation.second.first.end(), symbol) != pushdownStoreOperation.second.first.end())
785 return true;
786 if (std::find(pushdownStoreOperation.second.second.begin(), pushdownStoreOperation.second.second.end(), symbol) != pushdownStoreOperation.second.second.end())
787 return true;
788 }
789
790 if(automaton.getInitialSymbol() == symbol)
791 return true;
792
793 return false;
794 }
795
805 return true;
806 }
807
814 static void valid ( const automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
815 }
816};
817
825template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
826class ElementConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::InitialSymbol > {
827public:
837 return automaton.template accessComponent < automaton::PushdownStoreAlphabet > ( ).get ( ).count ( symbol );
838 }
839
846 static void valid ( const automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
847 }
848};
849
857template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
858class SetConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::States > {
859public:
869 if ( automaton.getInitialState ( ) == state )
870 return true;
871
872 if ( automaton.getFinalStates ( ).count ( state ) )
873 return true;
874
875 for ( const std::pair < const ext::pair < StateType, InputSymbolType >, StateType > & transition : automaton.getTransitions ( ) )
876 if (transition.first.first == state || transition.second == state )
877 return true;
878
879 return false;
880 }
881
891 return true;
892 }
893
901 }
902};
903
911template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
912class SetConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::FinalStates > {
913public:
923 return false;
924 }
925
935 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
936 }
937
945 }
946};
947
955template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
956class ElementConstraint< automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::InitialState > {
957public:
967 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
968 }
969
977 }
978};
979
985template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
986struct normalize < automaton::InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > > {
988 ext::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getInputAlphabet ( ) );
989 ext::set < DefaultSymbolType > pushdownAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getPushdownStoreAlphabet ( ) );
990 DefaultSymbolType initialSymbol = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( value ).getInitialSymbol ( ) );
991 ext::set < DefaultStateType > states = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getStates ( ) );
992 DefaultStateType initialState = automaton::AutomatonNormalize::normalizeState ( std::move ( value ).getInitialState ( ) );
993 ext::set < DefaultStateType > finalStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getFinalStates ( ) );
994
995 automaton::InputDrivenNPDA < > res ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) );
996
997 for ( std::pair < InputSymbolType, ext::pair < ext::vector < PushdownStoreSymbolType >, ext::vector < PushdownStoreSymbolType > > > && pushdownOperation : ext::make_mover ( std::move ( value ).getPushdownStoreOperations ( ) ) ) {
998 DefaultSymbolType target = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) );
999 ext::vector < DefaultSymbolType > pop = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) );
1000 ext::vector < DefaultSymbolType > push = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) );
1001
1002 res.setPushdownStoreOperation ( std::move ( target ), std::move ( pop ), std::move ( push ) );
1003 }
1004
1005 for ( std::pair < ext::pair < StateType, InputSymbolType >, StateType > && transition : ext::make_mover ( std::move ( value ).getTransitions ( ) ) ) {
1006 DefaultStateType targets = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.second ) );
1007
1008 DefaultStateType from = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) );
1009 DefaultSymbolType input = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( transition.first.second ) );
1010
1011 res.addTransition ( std::move ( from ), std::move ( input ), std::move ( targets ) );
1012 }
1013
1014 return res;
1015 }
1016};
1017
1018} /* namespace core */
1019
1020extern template class automaton::InputDrivenNPDA < >;
1021
static ext::set< DefaultSymbolType > normalizeAlphabet(ext::set< SymbolType > &&symbols)
Definition: SymbolNormalize.h:50
static ext::vector< DefaultSymbolType > normalizeSymbols(ext::vector< SymbolType > &&symbols)
Definition: SymbolNormalize.h:86
static DefaultSymbolType normalizeSymbol(SymbolType &&symbol)
Definition: SymbolNormalize.h:68
Definition: AutomatonException.h:15
static DefaultStateType normalizeState(StateType &&state)
Definition: AutomatonNormalize.h:76
static ext::multiset< DefaultStateType > normalizeStates(ext::multiset< StateType > &&states)
Definition: AutomatonNormalize.h:49
Nondeterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenNPDA.h:79
bool operator==(const InputDrivenNPDA &other) const
Definition: InputDrivenNPDA.h:528
bool addFinalState(StateType state)
Definition: InputDrivenNPDA.h:229
bool addPushdownStoreSymbol(PushdownStoreSymbolType symbol)
Definition: InputDrivenNPDA.h:278
bool clearPushdownStoreOperation(const InputSymbolType &input)
Definition: InputDrivenNPDA.h:604
bool isDeterministic() const
Determines whether the automaton is deterministic.
Definition: InputDrivenNPDA.h:701
void removePushdownStoreSymbol(const PushdownStoreSymbolType &symbol)
Definition: InputDrivenNPDA.h:307
bool setInitialState(StateType state)
Definition: InputDrivenNPDA.h:151
void removeInputSymbol(const InputSymbolType &symbol)
Definition: InputDrivenNPDA.h:394
void setPushdownStoreOperations(ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > operations)
Definition: InputDrivenNPDA.h:588
void setInputAlphabet(ext::set< InputSymbolType > symbols)
Definition: InputDrivenNPDA.h:383
bool removeTransition(const StateType &from, const InputSymbolType &input, const StateType &to)
Removes a transition from the automaton.
Definition: InputDrivenNPDA.h:649
bool setInitialSymbol(PushdownStoreSymbolType symbol)
Definition: InputDrivenNPDA.h:336
ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > getTransitionsToState(const StateType &to) const
Definition: InputDrivenNPDA.h:686
void addInputSymbols(ext::set< InputSymbolType > symbols)
Definition: InputDrivenNPDA.h:374
void removeFinalState(const StateType &state)
Definition: InputDrivenNPDA.h:249
StateType && getInitialState() &&
Definition: InputDrivenNPDA.h:140
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: InputDrivenNPDA.h:316
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenNPDA.h:614
InputSymbolTypeT InputSymbolType
Definition: InputDrivenNPDA.h:81
void setPushdownStoreAlphabet(ext::set< PushdownStoreSymbolType > symbols)
Definition: InputDrivenNPDA.h:296
const ext::set< InputSymbolType > & getInputAlphabet() const &
Definition: InputDrivenNPDA.h:345
void setFinalStates(ext::set< StateType > states)
Definition: InputDrivenNPDA.h:238
ext::set< StateType > && getStates() &&
Definition: InputDrivenNPDA.h:169
const ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenNPDA.h:661
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenNPDA.h:209
ext::set< PushdownStoreSymbolType > && getPushdownStoreAlphabet() &&
Definition: InputDrivenNPDA.h:267
bool setPushdownStoreOperation(InputSymbolType input, ext::vector< PushdownStoreSymbolType > pop, ext::vector< PushdownStoreSymbolType > push)
Definition: InputDrivenNPDA.h:582
const ext::set< PushdownStoreSymbolType > & getPushdownStoreAlphabet() const &
Definition: InputDrivenNPDA.h:258
PushdownStoreSymbolTypeT PushdownStoreSymbolType
Definition: InputDrivenNPDA.h:82
PushdownStoreSymbolType && getInitialSymbol() &&
Definition: InputDrivenNPDA.h:325
InputDrivenNPDA(ext::set< StateType > states, ext::set< InputSymbolType > inputAlphabet, ext::set< PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set< StateType > finalStates)
Creates a new instance of the automaton with a concrete set of states, input alphabet,...
Definition: InputDrivenNPDA.h:555
ext::set< StateType > && getFinalStates() &&
Definition: InputDrivenNPDA.h:218
const StateType & getInitialState() const &
Definition: InputDrivenNPDA.h:131
const ext::set< StateType > & getStates() const &
Definition: InputDrivenNPDA.h:160
void removeState(const StateType &state)
Definition: InputDrivenNPDA.h:200
void addPushdownStoreSymbols(ext::set< PushdownStoreSymbolType > symbols)
Definition: InputDrivenNPDA.h:287
bool addState(StateType state)
Definition: InputDrivenNPDA.h:180
bool addInputSymbol(InputSymbolType symbol)
Definition: InputDrivenNPDA.h:365
StateTypeT StateType
Definition: InputDrivenNPDA.h:83
ext::set< InputSymbolType > && getInputAlphabet() &&
Definition: InputDrivenNPDA.h:354
void setStates(ext::set< StateType > states)
Definition: InputDrivenNPDA.h:189
friend ext::ostream & operator<<(ext::ostream &out, const InputDrivenNPDA &instance)
Definition: InputDrivenNPDA.h:540
ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > getTransitionsFromState(const StateType &from) const
Definition: InputDrivenNPDA.h:671
bool addTransition(StateType from, InputSymbolType input, StateType to)
Adds a transition to the automaton.
Definition: InputDrivenNPDA.h:624
Definition: components.hpp:181
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenNPDA.h:976
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenNPDA.h:966
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: InputDrivenNPDA.h:836
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenNPDA.h:846
Definition: components.hpp:25
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenNPDA.h:934
static bool used(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenNPDA.h:922
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenNPDA.h:944
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: InputDrivenNPDA.h:750
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: InputDrivenNPDA.h:760
static bool used(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const InputSymbolType &symbol)
Definition: InputDrivenNPDA.h:734
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenNPDA.h:814
static bool used(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: InputDrivenNPDA.h:782
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenNPDA.h:804
static bool used(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenNPDA.h:868
static bool available(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenNPDA.h:890
static void valid(const automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenNPDA.h:900
Definition: setComponents.hpp:26
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: 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
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: Object.h:16
Definition: BarSymbol.cpp:12
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
return res
Definition: MinimizeByPartitioning.h:145
Definition: ToGrammar.h:31
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
key_iterator< map_type > key_begin(const map_type &m)
Definition: iterator.hpp:1027
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
key_iterator< map_type > key_end(const map_type &m)
Definition: iterator.hpp:1041
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void end()
Definition: measurements.cpp:19
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
static automaton::InputDrivenNPDA< > eval(automaton::InputDrivenNPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &&value)
Definition: InputDrivenNPDA.h:987
Definition: normalize.hpp:13