Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
NPDTA.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
27#include <ext/algorithm>
28
29#include <alib/set>
30#include <alib/multimap>
31#include <alib/vector>
32
33#include <core/components.hpp>
34
37
39
40#include <core/normalize.hpp>
43
44namespace automaton {
45
46class InputAlphabet;
47class OutputAlphabet;
48class PushdownStoreAlphabet;
49class InitialSymbol;
50class States;
51class FinalStates;
52class InitialState;
53
74template < class InputSymbolTypeT = DefaultSymbolType, class OutputSymbolTypeT = DefaultSymbolType, class PushdownStoreSymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType >
75class NPDTA final : public core::Components < NPDTA < InputSymbolTypeT, OutputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >, ext::set < InputSymbolTypeT >, component::Set, InputAlphabet, ext::set < OutputSymbolTypeT >, component::Set, OutputAlphabet, ext::set < PushdownStoreSymbolTypeT >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolTypeT, component::Value, InitialSymbol, ext::set < StateTypeT >, component::Set, std::tuple < States, FinalStates >, StateTypeT, component::Value, InitialState > {
76public:
77 typedef InputSymbolTypeT InputSymbolType;
78 typedef OutputSymbolTypeT OutputSymbolType;
79 typedef PushdownStoreSymbolTypeT PushdownStoreSymbolType;
80 typedef StateTypeT StateType;
81
82private:
87
88public:
100 explicit NPDTA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < OutputSymbolType > outputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates );
101
108 explicit NPDTA ( StateType initialState, PushdownStoreSymbolType initialPushdownSymbol );
109
115 const StateType & getInitialState ( ) const & {
116 return this-> template accessComponent < InitialState > ( ).get ( );
117 }
118
125 return std::move ( this-> template accessComponent < InitialState > ( ).get ( ) );
126 }
127
135 bool setInitialState ( StateType state ) {
136 return this-> template accessComponent < InitialState > ( ).set ( std::move ( state ) );
137 }
138
144 const ext::set < StateType > & getStates ( ) const & {
145 return this-> template accessComponent < States > ( ).get ( );
146 }
147
154 return std::move ( this-> template accessComponent < States > ( ).get ( ) );
155 }
156
164 bool addState ( StateType state ) {
165 return this-> template accessComponent < States > ( ).add ( std::move ( state ) );
166 }
167
174 this-> template accessComponent < States > ( ).set ( std::move ( states ) );
175 }
176
184 void removeState ( const StateType & state ) {
185 this-> template accessComponent < States > ( ).remove ( state );
186 }
187
194 return this-> template accessComponent < FinalStates > ( ).get ( );
195 }
196
203 return std::move ( this-> template accessComponent < FinalStates > ( ).get ( ) );
204 }
205
213 bool addFinalState ( StateType state ) {
214 return this-> template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
215 }
216
223 this-> template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
224 }
225
233 void removeFinalState ( const StateType & state ) {
234 this-> template accessComponent < FinalStates > ( ).remove ( state );
235 }
236
243 return this->template accessComponent < PushdownStoreAlphabet > ( ).get ( );
244 }
245
252 return std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) );
253 }
254
263 return this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbol ) );
264 }
265
272 this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbols ) );
273 }
274
281 this->template accessComponent < PushdownStoreAlphabet > ( ).set ( std::move ( symbols ) );
282 }
283
292 this->template accessComponent < PushdownStoreAlphabet > ( ).remove ( symbol );
293 }
294
301 return this->template accessComponent < InitialSymbol > ( ).get ( );
302 }
303
310 return std::move ( this->template accessComponent < InitialSymbol > ( ).get ( ) );
311 }
312
321 return this->template accessComponent < InitialSymbol > ( ).set ( std::move ( symbol ) );
322 }
323
330 return this-> template accessComponent < InputAlphabet > ( ).get ( );
331 }
332
339 return std::move ( this-> template accessComponent < InputAlphabet > ( ).get ( ) );
340 }
341
350 return this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
351 }
352
359 this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
360 }
361
368 this-> template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
369 }
370
378 void removeInputSymbol ( const InputSymbolType & symbol ) {
379 this-> template accessComponent < InputAlphabet > ( ).remove ( symbol );
380 }
381
388 return this->template accessComponent < OutputAlphabet > ( ).get ( );
389 }
390
397 return std::move ( this->template accessComponent < OutputAlphabet > ( ).get ( ) );
398 }
399
408 return this->template accessComponent < OutputAlphabet > ( ).add ( std::move ( symbol ) );
409 }
410
417 this->template accessComponent < OutputAlphabet > ( ).add ( std::move ( symbols ) );
418 }
419
426 this->template accessComponent < OutputAlphabet > ( ).set ( std::move ( symbols ) );
427 }
428
436 void removeOutputSymbol ( const OutputSymbolType & symbol ) {
437 this->template accessComponent < OutputAlphabet > ( ).remove ( symbol );
438 }
439
457
475
492
510
528
545
552
558 ext::multimap < ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::tuple < StateType, ext::vector < PushdownStoreSymbolType >, ext::vector < OutputSymbolType > > > && getTransitions ( ) &&;
559
567 ext::multimap < ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::tuple < StateType, ext::vector < PushdownStoreSymbolType >, ext::vector < OutputSymbolType > > > getTransitionsFromState ( const StateType & from ) const;
568
576 auto operator <=> ( const NPDTA & other ) const {
577 return std::tie(getStates(), getInputAlphabet(), getOutputAlphabet(), getInitialState(), getFinalStates(), getPushdownStoreAlphabet(), getInitialSymbol(), transitions) <=> std::tie(other.getStates(), other.getInputAlphabet(), other.getOutputAlphabet(), other.getInitialState(), other.getFinalStates(), other.getPushdownStoreAlphabet(), other.getInitialSymbol(), other.transitions);
578 }
579
587 bool operator == ( const NPDTA & other ) const {
589 }
590
599 friend ext::ostream & operator << ( ext::ostream & out, const NPDTA & instance ) {
600 return out << "(NPDTA"
601 << " states = " << instance.getStates ( )
602 << " inputAlphabet = " << instance.getInputAlphabet ( )
603 << " outputAlphabet = " << instance.getOutputAlphabet ( )
604 << " initialState = " << instance.getInitialState ( )
605 << " finalStates = " << instance.getFinalStates ( )
606 << " pushdownStoreAlphabet = " << instance.getPushdownStoreAlphabet ( )
607 << " initialSymbol = " << instance.getInitialSymbol ( )
608 << " transitions = " << instance.getTransitions ( )
609 << ")";
610 }
611};
612
613template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
614NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >::NPDTA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < OutputSymbolType > outputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates ) : core::Components < NPDTA, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < OutputSymbolType >, component::Set, OutputAlphabet, 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 ( outputAlphabet ), std::move ( pushdownStoreAlphabet ), std::move ( initialSymbol ), std::move ( states ), std::move ( finalStates ), std::move ( initialState ) ) {
615}
616
617template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
619}
620
621template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
623 if (!getStates().count(from)) {
624 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist.");
625 }
626
627 if ( ! input.is_epsilon ( ) && !getInputAlphabet().count(input.getSymbol ( ) ) ) {
628 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
629 }
630
631 if (!getStates().count(to)) {
632 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist.");
633 }
634
635 for(const PushdownStoreSymbolType& popSymbol : pop) {
636 if (!getPushdownStoreAlphabet().count(popSymbol)) {
637 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( popSymbol ) + "\" doesn't exist.");
638 }
639 }
640
641 for(const PushdownStoreSymbolType& pushSymbol : push) {
642 if (!getPushdownStoreAlphabet().count(pushSymbol)) {
643 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( pushSymbol ) + "\" doesn't exist.");
644 }
645 }
646
647 for(const OutputSymbolType& outputSymbol : output) {
648 if (!getOutputAlphabet().count(outputSymbol)) {
649 throw AutomatonException("Output symbol \"" + ext::to_string ( outputSymbol ) + "\" doesn't exist.");
650 }
651 }
652
653 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input, pop ) );
654 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input, pop ) );
655
656 ext::tuple < StateType, ext::vector < PushdownStoreSymbolType >, ext::vector < OutputSymbolType > > value ( std::move ( to ), std::move ( push ), std::move ( output ) );
657
658 auto iter = std::lower_bound ( lower_bound, upper_bound, value, [ ] ( const auto & transition, const auto & target ) { return transition.second < target; } );
659 if ( iter != upper_bound && value >= iter->second )
660 return false;
661
662 ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > > key ( std::move ( from ), std::move ( input ), std::move ( pop ) );
663 transitions.insert ( iter, std::make_pair ( std::move ( key ), std::move ( value ) ) );
664 return true;
665}
666
667template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
669 common::symbol_or_epsilon < InputSymbolType > inputVariant(std::move(input));
670 return addTransition(std::move(from), std::move(inputVariant), std::move(pop), std::move(to), std::move(push), std::move(output));
671}
672
673template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
675 auto inputVariant = common::symbol_or_epsilon < InputSymbolType > ( );
676 return addTransition(std::move(from), std::move(inputVariant), std::move(pop), std::move(to), std::move(push), std::move(output));
677}
678
679template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
681 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input, pop ) );
682 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input, pop ) );
683 auto iter = std::find_if ( lower_bound, upper_bound, [ & ] ( const auto & transition ) { return std::get < 0 > ( transition.second ) == to && std::get < 1 > ( transition.second ) == push && std::get < 2 > ( transition.second ) == output; } );
684 if ( iter == upper_bound )
685 return false;
686
687 transitions.erase ( iter );
688 return true;
689}
690
691template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
694 return removeTransition(from, inputVariant, pop, to, push, output);
695}
696
697template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
699 auto inputVariant = common::symbol_or_epsilon < InputSymbolType > ( );
700 return removeTransition(from, inputVariant, pop, to, push, output);
701}
702
703template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
705 return transitions;
706}
707
708template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
710 return std::move ( transitions );
711}
712
713template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
715 if( !getStates().count(from))
716 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist");
717
719 for ( const auto & transition: transitions ) {
720 if ( std::get<0>(transition.first) == from ) {
721 transitionsFromState.insert ( transition );
722 }
723 }
724
725 return transitionsFromState;
726}
727
728} /* namespace automaton */
729
730namespace core {
731
740template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
741class SetConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, InputSymbolType, automaton::InputAlphabet > {
742public:
753 if ( ! std::get<1>(transition.first).is_epsilon ( ) && symbol == std::get<1>(transition.first).getSymbol ( ) )
754 return true;
755
756 return false;
757 }
758
768 return true;
769 }
770
778 }
779};
780
789template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
790class SetConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, OutputSymbolType, automaton::OutputAlphabet > {
791public:
802 if (std::find(std::get<2>(transition.second).begin(), std::get<2>(transition.second).end(), symbol) != std::get<2>(transition.second).end())
803 return true;
804
805 return false;
806 }
807
817 return true;
818 }
819
827 }
828};
829
838template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
839class SetConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::PushdownStoreAlphabet > {
840public:
850 if(automaton.getInitialSymbol() == symbol)
851 return true;
852
854 for (const PushdownStoreSymbolType& popSymbol : std::get<2>(transition.first))
855 if (symbol == popSymbol)
856 return true;
857
858 if (std::find(std::get<1>(transition.second).begin(), std::get<1>(transition.second).end(), symbol) != std::get<1>(transition.second).end())
859 return true;
860 }
861
862 return false;
863 }
864
874 return true;
875 }
876
884 }
885};
886
895template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
896class ElementConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::InitialSymbol > {
897public:
907 return automaton.template accessComponent < automaton::PushdownStoreAlphabet > ( ).get ( ).count ( symbol );
908 }
909
917 }
918};
919
928template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
929class SetConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::States > {
930public:
940 if ( automaton.getInitialState ( ) == state )
941 return true;
942
943 if ( automaton.getFinalStates ( ).count ( state ) )
944 return true;
945
947 if (state == std::get<0>(transition.first))
948 return true;
949
950 if(std::get<0>(transition.second) == state)
951 return true;
952 }
953
954 return false;
955 }
956
966 return true;
967 }
968
976 }
977};
978
987template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
988class SetConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::FinalStates > {
989public:
999 return false;
1000 }
1001
1011 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
1012 }
1013
1021 }
1022};
1023
1032template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
1033class ElementConstraint< automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::InitialState > {
1034public:
1044 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
1045 }
1046
1054 }
1055};
1056
1062template < class InputSymbolType, class OutputSymbolType, class PushdownStoreSymbolType, class StateType >
1063struct normalize < automaton::NPDTA < InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > > {
1065 ext::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getInputAlphabet ( ) );
1066 ext::set < DefaultSymbolType > outputAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getOutputAlphabet ( ) );
1067 ext::set < DefaultSymbolType > pushdownAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getPushdownStoreAlphabet ( ) );
1068 DefaultSymbolType initialSymbol = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( value ).getInitialSymbol ( ) );
1069 ext::set < DefaultStateType > states = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getStates ( ) );
1070 DefaultStateType initialState = automaton::AutomatonNormalize::normalizeState ( std::move ( value ).getInitialState ( ) );
1071 ext::set < DefaultStateType > finalStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getFinalStates ( ) );
1072
1073 automaton::NPDTA < > res ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( outputAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) );
1074
1076 DefaultStateType to = automaton::AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.second ) ) );
1077 ext::vector < DefaultSymbolType > push = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( std::get < 1 > ( transition.second ) ) );
1078
1079 ext::vector < DefaultSymbolType > output = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.second ) ) );
1080
1081 ext::vector < DefaultSymbolType > pop = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) );
1082 DefaultStateType from = automaton::AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) );
1083 common::symbol_or_epsilon < DefaultSymbolType > input = automaton::AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) );
1084
1085 res.addTransition ( std::move ( from ), std::move ( input ), std::move ( pop ), std::move ( to ), std::move ( push ), std::move ( output ) );
1086 }
1087
1088 return res;
1089 }
1090};
1091
1092} /* namespace core */
1093
1094extern template class automaton::NPDTA < >;
1095
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 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
Definition: NPDTA.h:75
ext::set< OutputSymbolType > && getOutputAlphabet() &&
Definition: NPDTA.h:396
void setOutputAlphabet(ext::set< OutputSymbolType > symbols)
Definition: NPDTA.h:425
void addOutputSymbols(ext::set< OutputSymbolType > symbols)
Definition: NPDTA.h:416
const ext::set< StateType > & getFinalStates() const &
Definition: NPDTA.h:193
const StateType & getInitialState() const &
Definition: NPDTA.h:115
bool addTransition(StateType from, common::symbol_or_epsilon< InputSymbolType > input, ext::vector< PushdownStoreSymbolType > pop, StateType to, ext::vector< PushdownStoreSymbolType > push, ext::vector< OutputSymbolType > output)
Adds a transition to the automaton.
Definition: NPDTA.h:622
const ext::set< PushdownStoreSymbolType > & getPushdownStoreAlphabet() const &
Definition: NPDTA.h:242
OutputSymbolTypeT OutputSymbolType
Definition: NPDTA.h:78
void removeState(const StateType &state)
Definition: NPDTA.h:184
bool setInitialSymbol(PushdownStoreSymbolType symbol)
Definition: NPDTA.h:320
ext::set< StateType > && getStates() &&
Definition: NPDTA.h:153
const ext::set< OutputSymbolType > & getOutputAlphabet() const &
Definition: NPDTA.h:387
void removeInputSymbol(const InputSymbolType &symbol)
Definition: NPDTA.h:378
bool addPushdownStoreSymbol(PushdownStoreSymbolType symbol)
Definition: NPDTA.h:262
friend ext::ostream & operator<<(ext::ostream &out, const NPDTA &instance)
Definition: NPDTA.h:599
NPDTA(ext::set< StateType > states, ext::set< InputSymbolType > inputAlphabet, ext::set< OutputSymbolType > outputAlphabet, 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: NPDTA.h:614
InputSymbolTypeT InputSymbolType
Definition: NPDTA.h:77
void removeFinalState(const StateType &state)
Definition: NPDTA.h:233
void setInputAlphabet(ext::set< InputSymbolType > symbols)
Definition: NPDTA.h:367
bool addInputSymbol(InputSymbolType symbol)
Definition: NPDTA.h:349
ext::set< StateType > && getFinalStates() &&
Definition: NPDTA.h:202
bool addState(StateType state)
Definition: NPDTA.h:164
PushdownStoreSymbolType && getInitialSymbol() &&
Definition: NPDTA.h:309
StateTypeT StateType
Definition: NPDTA.h:80
void setStates(ext::set< StateType > states)
Definition: NPDTA.h:173
bool removeTransition(const StateType &from, const common::symbol_or_epsilon< InputSymbolType > &input, const ext::vector< PushdownStoreSymbolType > &pop, const StateType &to, const ext::vector< PushdownStoreSymbolType > &push, const ext::vector< OutputSymbolType > &output)
Removes a transition from the automaton.
Definition: NPDTA.h:680
bool setInitialState(StateType state)
Definition: NPDTA.h:135
bool addFinalState(StateType state)
Definition: NPDTA.h:213
void removeOutputSymbol(const OutputSymbolType &symbol)
Definition: NPDTA.h:436
const ext::set< StateType > & getStates() const &
Definition: NPDTA.h:144
ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::tuple< StateType, ext::vector< PushdownStoreSymbolType >, ext::vector< OutputSymbolType > > > getTransitionsFromState(const StateType &from) const
Definition: NPDTA.h:714
bool operator==(const NPDTA &other) const
Definition: NPDTA.h:587
bool addOutputSymbol(OutputSymbolType symbol)
Definition: NPDTA.h:407
ext::set< InputSymbolType > && getInputAlphabet() &&
Definition: NPDTA.h:338
PushdownStoreSymbolTypeT PushdownStoreSymbolType
Definition: NPDTA.h:79
void addInputSymbols(ext::set< InputSymbolType > symbols)
Definition: NPDTA.h:358
const ext::set< InputSymbolType > & getInputAlphabet() const &
Definition: NPDTA.h:329
void setPushdownStoreAlphabet(ext::set< PushdownStoreSymbolType > symbols)
Definition: NPDTA.h:280
void setFinalStates(ext::set< StateType > states)
Definition: NPDTA.h:222
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::tuple< StateType, ext::vector< PushdownStoreSymbolType >, ext::vector< OutputSymbolType > > > & getTransitions() const &
Definition: NPDTA.h:704
void removePushdownStoreSymbol(const PushdownStoreSymbolType &symbol)
Definition: NPDTA.h:291
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: NPDTA.h:300
StateType && getInitialState() &&
Definition: NPDTA.h:124
ext::set< PushdownStoreSymbolType > && getPushdownStoreAlphabet() &&
Definition: NPDTA.h:251
void addPushdownStoreSymbols(ext::set< PushdownStoreSymbolType > symbols)
Definition: NPDTA.h:271
Definition: symbol_or_epsilon.hpp:24
Definition: components.hpp:181
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDTA.h:1043
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDTA.h:1053
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDTA.h:916
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: NPDTA.h:906
Definition: components.hpp:25
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: NPDTA.h:767
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: NPDTA.h:777
static bool used(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const InputSymbolType &symbol)
Definition: NPDTA.h:751
static bool used(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDTA.h:939
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDTA.h:965
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDTA.h:975
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDTA.h:1020
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDTA.h:1010
static bool used(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDTA.h:998
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const OutputSymbolType &)
Definition: NPDTA.h:826
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const OutputSymbolType &)
Definition: NPDTA.h:816
static bool used(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const OutputSymbolType &symbol)
Definition: NPDTA.h:800
static void valid(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDTA.h:883
static bool used(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: NPDTA.h:849
static bool available(const automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDTA.h:873
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
Definition: set.hpp:44
Class extending the tuple class from the standard library. Original reason is to allow printing of th...
Definition: tuple.hpp:42
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: 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::NPDTA< > eval(automaton::NPDTA< InputSymbolType, OutputSymbolType, PushdownStoreSymbolType, StateType > &&value)
Definition: NPDTA.h:1064
Definition: normalize.hpp:13