Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
InputDrivenDPDA.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/map>
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 InputDrivenDPDA final : public core::Components < InputDrivenDPDA < 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 InputDrivenDPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates );
117
124 explicit InputDrivenDPDA ( 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::map < ext::pair < StateType, InputSymbolType >, StateType > & getTransitions ( ) const &;
474
480 ext::map < ext::pair < StateType, InputSymbolType >, StateType > && getTransitions ( ) &&;
481
489 ext::map < ext::pair < StateType, InputSymbolType >, StateType > getTransitionsFromState ( const StateType & from ) const;
490
498 ext::map < ext::pair < StateType, InputSymbolType >, StateType > getTransitionsToState ( const StateType & to ) const;
499
507 auto operator <=> ( const InputDrivenDPDA & other ) const {
508 return ext::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);
509 }
510
518 bool operator == ( const InputDrivenDPDA & other ) const {
520 }
521
530 friend ext::ostream & operator << ( ext::ostream & out, const InputDrivenDPDA & instance ) {
531 return out << "(InputDrivenDPDA"
532 << " states = " << instance.getStates ( )
533 << " inputAlphabet = " << instance.getInputAlphabet ( )
534 << " initialState = " << instance.getInitialState ( )
535 << " finalStates = " << instance.getFinalStates ( )
536 << " pushdownStoreAlphabet = " << instance.getPushdownStoreAlphabet ( )
537 << " initialSymbol = " << instance.getInitialSymbol ( )
538 << " transitions = " << instance.getTransitions ( )
539 << " inputSymbolToPushdownStoreOperation = " << instance.getPushdownStoreOperations ( )
540 << ")";
541 }
542};
543
544template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
545InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::InputDrivenDPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates ) : core::Components < InputDrivenDPDA, 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 ) ) {
546}
547
548template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
550}
551
552template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
553void InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::checkPushdownStoreOperation(const InputSymbolType& input, const ext::vector<PushdownStoreSymbolType>& pop, const ext::vector<PushdownStoreSymbolType>& push) {
554 if (! getInputAlphabet().count(input)) {
555 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
556 }
557
558 for(const PushdownStoreSymbolType& popSymbol : pop) {
559 if (! getPushdownStoreAlphabet().count(popSymbol)) {
560 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( popSymbol ) + "\" doesn't exist.");
561 }
562 }
563
564 for(const PushdownStoreSymbolType& pushSymbol : push) {
565 if (! getPushdownStoreAlphabet().count(pushSymbol)) {
566 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( pushSymbol ) + "\" doesn't exist.");
567 }
568 }
569}
570
571template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
573 checkPushdownStoreOperation(input, pop, push);
574 return inputSymbolToPushdownStoreOperation.insert ( std::move( input ), ext::make_pair(std::move ( pop ), std::move( push ) ) ).second;
575}
576
577template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
580 std::set_difference(getInputAlphabet().begin(), getInputAlphabet().end(), ext::key_begin(operations), ext::key_end(operations), std::inserter(removed, removed.end()));
581
582 for(const InputSymbolType& removedSymbol : removed) {
583 clearPushdownStoreOperation(removedSymbol);
584 }
585
586 for(const auto& added : operations) {
587 checkPushdownStoreOperation(added.first, added.second.first, added.second.second);
588 }
589
590 inputSymbolToPushdownStoreOperation = std::move(operations);
591}
592
593template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
595 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType>& transition : transitions) {
596 if (transition.first.second == input)
597 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" is used.");
598 }
599
600 return inputSymbolToPushdownStoreOperation.erase(input);
601}
602
603template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
605 return inputSymbolToPushdownStoreOperation;
606}
607
608template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
610 return std::move ( inputSymbolToPushdownStoreOperation );
611}
612
613template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
615 if (!getStates().count(from))
616 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist.");
617
618 if (!getInputAlphabet().count(input))
619 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
620
621 if (! getPushdownStoreOperations().count(input))
622 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
623
624 if (! getStates().count(to))
625 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist.");
626
627 ext::pair<StateType, InputSymbolType> key = ext::make_pair(std::move(from), std::move(input));
628
629 if (transitions.find(key) != transitions.end()) {
630 if(transitions.find(key)->second == to)
631 return false;
632 else
633 throw AutomatonException( "Transition from this state and symbol already exists (\"" + ext::to_string ( key.first ) + "\", \"" + ext::to_string ( key.second ) + "\") -> \"" + ext::to_string ( to ) + "\"." );
634 }
635
636 transitions.insert ( std::move(key), std::move(to) );
637 return true;
638}
639
640template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
643
644 if (transitions.find(key) == transitions.end())
645 return false;
646
647 if(transitions.find(key)->second != to)
648 throw AutomatonException( "Transition (\"" + ext::to_string ( from ) + "\", \"" + ext::to_string ( input ) + "\") -> \"" + ext::to_string ( to ) + "\" doesn't exist.");
649
650 transitions.erase(key);
651 return true;
652}
653
654template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
656 return transitions;
657}
658
659template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
661 return std::move ( transitions );
662}
663
664template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
666 if( ! getStates().count(from))
667 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist");
668
670 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType>& transition : transitions) {
671 if (transition.first.first == from) {
672 transitionsFromState.insert(transition);
673 }
674 }
675
676 return transitionsFromState;
677}
678
679template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
681 if( ! getStates().count(to))
682 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist");
683
685 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType>& transition : transitions) {
686 if (transition.second == to) {
687 transitionsToState.insert(transition);
688 }
689 }
690
691 return transitionsToState;
692}
693
694} /* namespace automaton */
695
696namespace core {
697
705template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
706class SetConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, InputSymbolType, automaton::InputAlphabet > {
707public:
717 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType>& transition : automaton.getTransitions())
718 if (transition.first.second == symbol)
719 return true;
720
721 return false;
722 }
723
733 return true;
734 }
735
743 }
744};
745
753template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
754class SetConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::PushdownStoreAlphabet > {
755public:
764 static bool used ( const automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const PushdownStoreSymbolType & symbol ) {
765 for (const auto& pushdownStoreOperation : automaton.getPushdownStoreOperations()) {
766 if (std::find(pushdownStoreOperation.second.first.begin(), pushdownStoreOperation.second.first.end(), symbol) != pushdownStoreOperation.second.first.end())
767 return true;
768 if (std::find(pushdownStoreOperation.second.second.begin(), pushdownStoreOperation.second.second.end(), symbol) != pushdownStoreOperation.second.second.end())
769 return true;
770 }
771
772 if(automaton.getInitialSymbol() == symbol)
773 return true;
774
775 return false;
776 }
777
787 return true;
788 }
789
796 static void valid ( const automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
797 }
798};
799
807template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
808class ElementConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::InitialSymbol > {
809public:
819 return automaton.template accessComponent < automaton::PushdownStoreAlphabet > ( ).get ( ).count ( symbol );
820 }
821
828 static void valid ( const automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
829 }
830};
831
839template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
840class SetConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::States > {
841public:
851 if ( automaton.getInitialState ( ) == state )
852 return true;
853
854 if ( automaton.getFinalStates ( ).count ( state ) )
855 return true;
856
857 for ( const std::pair<const ext::pair<StateType, InputSymbolType>, StateType>& t : automaton.getTransitions())
858 if (t.first.first == state || t.second == state)
859 return true;
860
861 return false;
862 }
863
873 return true;
874 }
875
883 }
884};
885
893template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
894class SetConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::FinalStates > {
895public:
905 return false;
906 }
907
917 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
918 }
919
927 }
928};
929
937template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
938class ElementConstraint< automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::InitialState > {
939public:
949 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
950 }
951
959 }
960};
961
967template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
968struct normalize < automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > > {
970 ext::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getInputAlphabet ( ) );
971 ext::set < DefaultSymbolType > pushdownAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getPushdownStoreAlphabet ( ) );
972 DefaultSymbolType initialSymbol = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( value ).getInitialSymbol ( ) );
973 ext::set < DefaultStateType > states = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getStates ( ) );
974 DefaultStateType initialState = automaton::AutomatonNormalize::normalizeState ( std::move ( value ).getInitialState ( ) );
975 ext::set < DefaultStateType > finalStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getFinalStates ( ) );
976
977 automaton::InputDrivenDPDA < > res ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) );
978
979 for ( std::pair < InputSymbolType, ext::pair < ext::vector < PushdownStoreSymbolType >, ext::vector < PushdownStoreSymbolType > > > && pushdownOperation : ext::make_mover ( std::move ( value ).getPushdownStoreOperations ( ) ) ) {
980 DefaultSymbolType target = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) );
981 ext::vector < DefaultSymbolType > pop = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) );
982 ext::vector < DefaultSymbolType > push = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) );
983
984 res.setPushdownStoreOperation ( std::move ( target ), std::move ( pop ), std::move ( push ) );
985 }
986
987 for ( std::pair < ext::pair < StateType, InputSymbolType >, StateType > && transition : ext::make_mover ( std::move ( value ).getTransitions ( ) ) ) {
988 DefaultStateType from = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) );
989 DefaultSymbolType input = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( transition.first.second ) );
990
991 DefaultStateType to = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.second ) );
992
993 res.addTransition ( std::move ( from ), std::move ( input ), std::move ( to ) );
994 }
995
996 return res;
997 }
998};
999
1000} /* namespace core */
1001
1002extern template class automaton::InputDrivenDPDA < >;
1003
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
Deterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenDPDA.h:79
InputDrivenDPDA(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: InputDrivenDPDA.h:545
const ext::map< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenDPDA.h:655
bool operator==(const InputDrivenDPDA &other) const
Definition: InputDrivenDPDA.h:518
ext::set< StateType > && getStates() &&
Definition: InputDrivenDPDA.h:169
PushdownStoreSymbolType && getInitialSymbol() &&
Definition: InputDrivenDPDA.h:325
ext::set< StateType > && getFinalStates() &&
Definition: InputDrivenDPDA.h:218
bool setPushdownStoreOperation(InputSymbolType input, ext::vector< PushdownStoreSymbolType > pop, ext::vector< PushdownStoreSymbolType > push)
Definition: InputDrivenDPDA.h:572
PushdownStoreSymbolTypeT PushdownStoreSymbolType
Definition: InputDrivenDPDA.h:82
void setFinalStates(ext::set< StateType > states)
Definition: InputDrivenDPDA.h:238
void setStates(ext::set< StateType > states)
Definition: InputDrivenDPDA.h:189
const ext::set< StateType > & getStates() const &
Definition: InputDrivenDPDA.h:160
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: InputDrivenDPDA.h:316
StateTypeT StateType
Definition: InputDrivenDPDA.h:83
bool addTransition(StateType from, InputSymbolType input, StateType to)
Adds a transition to the automaton.
Definition: InputDrivenDPDA.h:614
bool setInitialState(StateType state)
Definition: InputDrivenDPDA.h:151
ext::set< PushdownStoreSymbolType > && getPushdownStoreAlphabet() &&
Definition: InputDrivenDPDA.h:267
bool addFinalState(StateType state)
Definition: InputDrivenDPDA.h:229
bool addState(StateType state)
Definition: InputDrivenDPDA.h:180
const ext::set< InputSymbolType > & getInputAlphabet() const &
Definition: InputDrivenDPDA.h:345
ext::map< ext::pair< StateType, InputSymbolType >, StateType > getTransitionsToState(const StateType &to) const
Definition: InputDrivenDPDA.h:680
void setPushdownStoreOperations(ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > operations)
Definition: InputDrivenDPDA.h:578
bool setInitialSymbol(PushdownStoreSymbolType symbol)
Definition: InputDrivenDPDA.h:336
bool addInputSymbol(InputSymbolType symbol)
Definition: InputDrivenDPDA.h:365
const ext::set< PushdownStoreSymbolType > & getPushdownStoreAlphabet() const &
Definition: InputDrivenDPDA.h:258
void setPushdownStoreAlphabet(ext::set< PushdownStoreSymbolType > symbols)
Definition: InputDrivenDPDA.h:296
InputSymbolTypeT InputSymbolType
Definition: InputDrivenDPDA.h:81
void addInputSymbols(ext::set< InputSymbolType > symbols)
Definition: InputDrivenDPDA.h:374
StateType && getInitialState() &&
Definition: InputDrivenDPDA.h:140
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenDPDA.h:209
void setInputAlphabet(ext::set< InputSymbolType > symbols)
Definition: InputDrivenDPDA.h:383
ext::map< ext::pair< StateType, InputSymbolType >, StateType > getTransitionsFromState(const StateType &from) const
Definition: InputDrivenDPDA.h:665
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenDPDA.h:604
bool addPushdownStoreSymbol(PushdownStoreSymbolType symbol)
Definition: InputDrivenDPDA.h:278
bool removeTransition(const StateType &from, const InputSymbolType &input, const StateType &to)
Removes a transition from the automaton.
Definition: InputDrivenDPDA.h:641
void removeInputSymbol(const InputSymbolType &symbol)
Definition: InputDrivenDPDA.h:394
void removePushdownStoreSymbol(const PushdownStoreSymbolType &symbol)
Definition: InputDrivenDPDA.h:307
void removeFinalState(const StateType &state)
Definition: InputDrivenDPDA.h:249
void addPushdownStoreSymbols(ext::set< PushdownStoreSymbolType > symbols)
Definition: InputDrivenDPDA.h:287
ext::set< InputSymbolType > && getInputAlphabet() &&
Definition: InputDrivenDPDA.h:354
bool clearPushdownStoreOperation(const InputSymbolType &input)
Definition: InputDrivenDPDA.h:594
const StateType & getInitialState() const &
Definition: InputDrivenDPDA.h:131
friend ext::ostream & operator<<(ext::ostream &out, const InputDrivenDPDA &instance)
Definition: InputDrivenDPDA.h:530
void removeState(const StateType &state)
Definition: InputDrivenDPDA.h:200
Definition: components.hpp:181
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenDPDA.h:828
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: InputDrivenDPDA.h:818
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenDPDA.h:948
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenDPDA.h:958
Definition: components.hpp:25
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenDPDA.h:916
static bool used(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenDPDA.h:904
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenDPDA.h:926
static bool used(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: InputDrivenDPDA.h:764
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenDPDA.h:786
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: InputDrivenDPDA.h:796
static bool used(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const InputSymbolType &symbol)
Definition: InputDrivenDPDA.h:716
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: InputDrivenDPDA.h:742
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: InputDrivenDPDA.h:732
static void valid(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenDPDA.h:882
static bool available(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: InputDrivenDPDA.h:872
static bool used(const automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: InputDrivenDPDA.h:850
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
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.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::InputDrivenDPDA< > eval(automaton::InputDrivenDPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &&value)
Definition: InputDrivenDPDA.h:969
Definition: normalize.hpp:13