Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
NPDA.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
44#include <automaton/PDA/DPDA.h>
45
46namespace automaton {
47
48class InputAlphabet;
49class PushdownStoreAlphabet;
50class InitialSymbol;
51class States;
52class FinalStates;
53class InitialState;
54
73template < class InputSymbolTypeT = DefaultSymbolType, class PushdownStoreSymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType >
74class NPDA final : public core::Components < NPDA < 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 > {
75public:
76 typedef InputSymbolTypeT InputSymbolType;
77 typedef PushdownStoreSymbolTypeT PushdownStoreSymbolType;
78 typedef StateTypeT StateType;
79
80private:
85
86public:
97 explicit NPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates );
98
105 explicit NPDA ( StateType initialState, PushdownStoreSymbolType initialPushdownSymbol );
106
107 /*
108 * \brief Creates a new instance of the automaton based on the Deterministic finite automaton.
109 *
110 * \param other the Deterministic finite automaton
111 */
113
119 const StateType & getInitialState ( ) const & {
120 return this-> template accessComponent < InitialState > ( ).get ( );
121 }
122
129 return std::move ( this-> template accessComponent < InitialState > ( ).get ( ) );
130 }
131
139 bool setInitialState ( StateType state ) {
140 return this-> template accessComponent < InitialState > ( ).set ( std::move ( state ) );
141 }
142
148 const ext::set < StateType > & getStates ( ) const & {
149 return this-> template accessComponent < States > ( ).get ( );
150 }
151
158 return std::move ( this-> template accessComponent < States > ( ).get ( ) );
159 }
160
168 bool addState ( StateType state ) {
169 return this-> template accessComponent < States > ( ).add ( std::move ( state ) );
170 }
171
178 this-> template accessComponent < States > ( ).set ( std::move ( states ) );
179 }
180
188 void removeState ( const StateType & state ) {
189 this-> template accessComponent < States > ( ).remove ( state );
190 }
191
198 return this-> template accessComponent < FinalStates > ( ).get ( );
199 }
200
207 return std::move ( this-> template accessComponent < FinalStates > ( ).get ( ) );
208 }
209
217 bool addFinalState ( StateType state ) {
218 return this-> template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
219 }
220
227 this-> template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
228 }
229
237 void removeFinalState ( const StateType & state ) {
238 this-> template accessComponent < FinalStates > ( ).remove ( state );
239 }
240
247 return this->template accessComponent < PushdownStoreAlphabet > ( ).get ( );
248 }
249
256 return std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) );
257 }
258
267 return this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbol ) );
268 }
269
276 this->template accessComponent < PushdownStoreAlphabet > ( ).add ( std::move ( symbols ) );
277 }
278
285 this->template accessComponent < PushdownStoreAlphabet > ( ).set ( std::move ( symbols ) );
286 }
287
296 this->template accessComponent < PushdownStoreAlphabet > ( ).remove ( symbol );
297 }
298
305 return this->template accessComponent < InitialSymbol > ( ).get ( );
306 }
307
314 return std::move ( this->template accessComponent < InitialSymbol > ( ).get ( ) );
315 }
316
325 return this->template accessComponent < InitialSymbol > ( ).set ( std::move ( symbol ) );
326 }
327
334 return this-> template accessComponent < InputAlphabet > ( ).get ( );
335 }
336
343 return std::move ( this-> template accessComponent < InputAlphabet > ( ).get ( ) );
344 }
345
354 return this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
355 }
356
363 this-> template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
364 }
365
372 this-> template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
373 }
374
382 void removeInputSymbol ( const InputSymbolType & symbol ) {
383 this-> template accessComponent < InputAlphabet > ( ).remove ( symbol );
384 }
385
402
419
435
452
468 bool removeTransition ( const StateType & from, const InputSymbolType & input, const ext::vector < PushdownStoreSymbolType > & pop, const StateType & to, const ext::vector < PushdownStoreSymbolType > & push );
469
485
492
498 ext::multimap < ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > && getTransitions ( ) &&;
499
507 ext::multimap < ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > getTransitionsFromState ( const StateType & from ) const;
508
516 ext::multimap < ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > getTransitionsToState ( const StateType & to ) const;
517
525 auto operator <=> ( const NPDA & other ) const {
526 return std::tie(getStates(), getInputAlphabet(), getInitialState(), getFinalStates(), getPushdownStoreAlphabet(), getInitialSymbol(), transitions) <=> std::tie(other.getStates(), other.getInputAlphabet(), other.getInitialState(), other.getFinalStates(), other.getPushdownStoreAlphabet(), other.getInitialSymbol(), other.transitions);
527 }
528
536 bool operator == ( const NPDA & other ) const {
538 }
539
548 friend ext::ostream & operator << ( ext::ostream & out, const NPDA & instance ) {
549 return out << "(NPDA"
550 << " states = " << instance.getStates ( )
551 << " inputAlphabet = " << instance.getInputAlphabet ( )
552 << " initialState = " << instance.getInitialState ( )
553 << " finalStates = " << instance.getFinalStates ( )
554 << " pushdownStoreAlphabet = " << instance.getPushdownStoreAlphabet ( )
555 << " initialSymbol = " << instance.getInitialSymbol ( )
556 << " transitions = " << instance.getTransitions ( )
557 << ")";
558 }
559};
560
561template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
562NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::NPDA ( ext::set < StateType > states, ext::set < InputSymbolType > inputAlphabet, ext::set < PushdownStoreSymbolType > pushdownStoreAlphabet, StateType initialState, PushdownStoreSymbolType initialSymbol, ext::set < StateType > finalStates ) : core::Components < NPDA, 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 ) ) {
563}
564
565template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
567}
568
569template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
570NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >::NPDA ( const DPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & other ) : NPDA ( other.getStates ( ), other.getInputAlphabet ( ), other.getPushdownStoreAlphabet ( ), other.getInitialState ( ), other.getInitialSymbol ( ), other.getFinalStates ( ) ) {
571 transitions.insert ( other.getTransitions ( ).begin ( ), other.getTransitions ( ).end ( ) );
572}
573
574template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
576 if (! getStates().count(from))
577 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist.");
578
579 if ( ! input.is_epsilon ( ) && ! getInputAlphabet().count(input.getSymbol ( ) ) )
580 throw AutomatonException("Input symbol \"" + ext::to_string ( input ) + "\" doesn't exist.");
581
582 if (! getStates().count(to))
583 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist.");
584
585 for(const PushdownStoreSymbolType& popSymbol : pop)
586 if (! getPushdownStoreAlphabet().count(popSymbol))
587 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( popSymbol ) + "\" doesn't exist.");
588
589 for(const PushdownStoreSymbolType& pushSymbol : push)
590 if (! getPushdownStoreAlphabet().count(pushSymbol))
591 throw AutomatonException("Pushdown store symbol \"" + ext::to_string ( pushSymbol ) + "\" doesn't exist.");
592
593 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input, pop ) );
594 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input, pop ) );
595
596 ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > value = ext::make_pair ( std::move ( to ), std::move ( push ) );
597
598 auto iter = std::lower_bound ( lower_bound, upper_bound, value, [ ] ( const auto & transition, const auto & target ) { return transition.second < target; } );
599 if ( iter != upper_bound && value >= iter->second )
600 return false;
601
602 ext::tuple < StateType, common::symbol_or_epsilon < InputSymbolType >, ext::vector < PushdownStoreSymbolType > > key ( std::move ( from ), std::move ( input ), std::move ( pop ) );
603 transitions.insert ( iter, std::make_pair ( std::move ( key ), std::move ( value ) ) );
604 return true;
605}
606
607template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
609 common::symbol_or_epsilon < InputSymbolType > inputVariant(std::move(input));
610 return addTransition(std::move(from), std::move(inputVariant), std::move(pop), std::move(to), std::move(push));
611}
612
613template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
615 auto inputVariant = common::symbol_or_epsilon < InputSymbolType > ( );
616 return addTransition(std::move(from), std::move(inputVariant), std::move(pop), std::move(to), std::move(push));
617}
618
619template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
621 auto upper_bound = transitions.upper_bound ( ext::tie ( from, input, pop ) );
622 auto lower_bound = transitions.lower_bound ( ext::tie ( from, input, pop ) );
623 auto iter = std::find_if ( lower_bound, upper_bound, [ & ] ( const auto & transition ) { return transition.second.first == to && transition.second.second == push; } );
624 if ( iter == upper_bound )
625 return false;
626
627 transitions.erase ( iter );
628 return true;
629}
630
631template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
634 return removeTransition(from, inputVariant, pop, to, push);
635}
636
637template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
639 auto inputVariant = common::symbol_or_epsilon < InputSymbolType > ( );
640 return removeTransition(from, inputVariant, pop, to, push);
641}
642
643template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
645 return transitions;
646}
647
648template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
650 return std::move ( transitions );
651}
652
653template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
655 if( ! getStates().count(from) )
656 throw AutomatonException("State \"" + ext::to_string ( from ) + "\" doesn't exist");
657
660 if (std::get<0>(transition.first) == from) {
661 transitionsFromState.insert ( transition.first, transition.second );
662 }
663 }
664
665 return transitionsFromState;
666}
667
668template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
670 if( ! getStates().count(to))
671 throw AutomatonException("State \"" + ext::to_string ( to ) + "\" doesn't exist");
672
675 if (transition.second.first == to) {
676 transitionsToState.insert ( transition.first, transition.second );
677 }
678 }
679
680 return transitionsToState;
681}
682
683} /* namespace automaton */
684
685namespace core {
686
694template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
695class SetConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, InputSymbolType, automaton::InputAlphabet > {
696public:
705 static bool used ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const InputSymbolType & symbol ) {
707 if ( ! std::get < 1 > ( transition.first ).is_epsilon ( ) && symbol == std::get<1>(transition.first).getSymbol ( ) )
708 return true;
709
710 return false;
711 }
712
722 return true;
723 }
724
732 }
733};
734
742template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
743class SetConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::PushdownStoreAlphabet > {
744public:
753 static bool used ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const PushdownStoreSymbolType & symbol ) {
754 if(automaton.getInitialSymbol() == symbol)
755 return true;
756
758 if (std::find(std::get<2>(transition.first).begin(), std::get<2>(transition.first).end(), symbol) != std::get<2>(transition.first).end())
759 return true;
760
761 if (std::find(transition.second.second.begin(), transition.second.second.end(), symbol) != transition.second.second.end())
762 return true;
763 }
764
765 return false;
766 }
767
776 static bool available ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
777 return true;
778 }
779
786 static void valid ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
787 }
788};
789
797template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
798class ElementConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, PushdownStoreSymbolType, automaton::InitialSymbol > {
799public:
808 static bool available ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const PushdownStoreSymbolType & symbol ) {
809 return automaton.template accessComponent < automaton::PushdownStoreAlphabet > ( ).get ( ).count ( symbol );
810 }
811
818 static void valid ( const automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType & ) {
819 }
820};
821
829template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
830class SetConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::States > {
831public:
841 if ( automaton.getInitialState ( ) == state )
842 return true;
843
844 if ( automaton.getFinalStates ( ).count ( state ) )
845 return true;
846
848 if (state == std::get<0>(transition.first))
849 return true;
850 if(transition.second.first == state)
851 return true;
852 }
853
854 return false;
855 }
856
866 return true;
867 }
868
876 }
877};
878
886template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
887class SetConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::FinalStates > {
888public:
898 return false;
899 }
900
910 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
911 }
912
920 }
921};
922
930template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
931class ElementConstraint< automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, StateType, automaton::InitialState > {
932public:
942 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
943 }
944
952 }
953};
954
960template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >
961struct normalize < automaton::NPDA < InputSymbolType, PushdownStoreSymbolType, StateType > > {
963 ext::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getInputAlphabet ( ) );
964 ext::set < DefaultSymbolType > pushdownAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getPushdownStoreAlphabet ( ) );
965 DefaultSymbolType initialSymbol = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( value ).getInitialSymbol ( ) );
966 ext::set < DefaultStateType > states = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getStates ( ) );
967 DefaultStateType initialState = automaton::AutomatonNormalize::normalizeState ( std::move ( value ).getInitialState ( ) );
968 ext::set < DefaultStateType > finalStates = automaton::AutomatonNormalize::normalizeStates ( std::move ( value ).getFinalStates ( ) );
969
970 automaton::NPDA < > res ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) );
971
973 DefaultStateType to = automaton::AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) );
974 ext::vector < DefaultSymbolType > push = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( transition.second.second ) );
975
976 ext::vector < DefaultSymbolType > pop = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) );
977 DefaultStateType from = automaton::AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) );
978 common::symbol_or_epsilon < DefaultSymbolType > input = automaton::AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) );
979
980 res.addTransition ( std::move ( from ), std::move ( input ), std::move ( pop ), std::move ( to ), std::move ( push ) );
981 }
982
983 return res;
984 }
985};
986
987} /* namespace core */
988
989extern template class automaton::NPDA < >;
990
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
Deterministic pushdown automaton. Accepts subset of context free languages.
Definition: DPDA.h:78
Definition: NPDA.h:74
bool setInitialSymbol(PushdownStoreSymbolType symbol)
Definition: NPDA.h:324
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: NPDA.h:304
ext::set< StateType > && getFinalStates() &&
Definition: NPDA.h:206
const ext::set< StateType > & getFinalStates() const &
Definition: NPDA.h:197
bool addFinalState(StateType state)
Definition: NPDA.h:217
PushdownStoreSymbolType && getInitialSymbol() &&
Definition: NPDA.h:313
void removeFinalState(const StateType &state)
Definition: NPDA.h:237
friend ext::ostream & operator<<(ext::ostream &out, const NPDA &instance)
Definition: NPDA.h:548
void setFinalStates(ext::set< StateType > states)
Definition: NPDA.h:226
bool addTransition(StateType from, common::symbol_or_epsilon< InputSymbolType > input, ext::vector< PushdownStoreSymbolType > pop, StateType to, ext::vector< PushdownStoreSymbolType > push)
Adds a transition to the automaton.
Definition: NPDA.h:575
void addInputSymbols(ext::set< InputSymbolType > symbols)
Definition: NPDA.h:362
ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > getTransitionsToState(const StateType &to) const
Definition: NPDA.h:669
InputSymbolTypeT InputSymbolType
Definition: NPDA.h:76
bool setInitialState(StateType state)
Definition: NPDA.h:139
void setStates(ext::set< StateType > states)
Definition: NPDA.h:177
StateType && getInitialState() &&
Definition: NPDA.h:128
ext::set< InputSymbolType > && getInputAlphabet() &&
Definition: NPDA.h:342
void setInputAlphabet(ext::set< InputSymbolType > symbols)
Definition: NPDA.h:371
const StateType & getInitialState() const &
Definition: NPDA.h:119
ext::set< StateType > && getStates() &&
Definition: NPDA.h:157
bool addInputSymbol(InputSymbolType symbol)
Definition: NPDA.h:353
void removePushdownStoreSymbol(const PushdownStoreSymbolType &symbol)
Definition: NPDA.h:295
NPDA(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: NPDA.h:562
ext::set< PushdownStoreSymbolType > && getPushdownStoreAlphabet() &&
Definition: NPDA.h:255
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)
Removes a transition from the automaton.
Definition: NPDA.h:620
const ext::set< StateType > & getStates() const &
Definition: NPDA.h:148
bool addState(StateType state)
Definition: NPDA.h:168
void removeInputSymbol(const InputSymbolType &symbol)
Definition: NPDA.h:382
ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > getTransitionsFromState(const StateType &from) const
Definition: NPDA.h:654
PushdownStoreSymbolTypeT PushdownStoreSymbolType
Definition: NPDA.h:77
void addPushdownStoreSymbols(ext::set< PushdownStoreSymbolType > symbols)
Definition: NPDA.h:275
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: NPDA.h:644
bool addPushdownStoreSymbol(PushdownStoreSymbolType symbol)
Definition: NPDA.h:266
void removeState(const StateType &state)
Definition: NPDA.h:188
void setPushdownStoreAlphabet(ext::set< PushdownStoreSymbolType > symbols)
Definition: NPDA.h:284
const ext::set< InputSymbolType > & getInputAlphabet() const &
Definition: NPDA.h:333
bool operator==(const NPDA &other) const
Definition: NPDA.h:536
const ext::set< PushdownStoreSymbolType > & getPushdownStoreAlphabet() const &
Definition: NPDA.h:246
StateTypeT StateType
Definition: NPDA.h:78
Definition: symbol_or_epsilon.hpp:24
Definition: components.hpp:181
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDA.h:818
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: NPDA.h:808
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDA.h:941
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDA.h:951
Definition: components.hpp:25
static bool used(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDA.h:840
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDA.h:875
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDA.h:865
static bool used(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const PushdownStoreSymbolType &symbol)
Definition: NPDA.h:753
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDA.h:786
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const PushdownStoreSymbolType &)
Definition: NPDA.h:776
static bool used(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDA.h:897
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const StateType &state)
Definition: NPDA.h:909
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const StateType &)
Definition: NPDA.h:919
static bool used(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &automaton, const InputSymbolType &symbol)
Definition: NPDA.h:705
static void valid(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: NPDA.h:731
static bool available(const automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &, const InputSymbolType &)
Definition: NPDA.h:721
Definition: setComponents.hpp:26
Class extending the multimap class from the standard library. Original reason is to allow printing of...
Definition: multimap.hpp:48
iterator insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: multimap.hpp:118
Definition: ostream.h:14
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: set.hpp:44
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::NPDA< > eval(automaton::NPDA< InputSymbolType, PushdownStoreSymbolType, StateType > &&value)
Definition: NPDA.h:962
Definition: normalize.hpp:13