From a8bf66d328c0b365aa66307f7451f49c119cfcb3 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 4 Apr 2017 08:35:29 +0200 Subject: [PATCH] normalize pushdown automata --- alib2data/src/automaton/PDA/DPDA.h | 25 +++++++++ alib2data/src/automaton/PDA/InputDrivenDPDA.h | 32 +++++++++++ alib2data/src/automaton/PDA/InputDrivenNPDA.h | 32 +++++++++++ alib2data/src/automaton/PDA/NPDA.h | 27 +++++++++ alib2data/src/automaton/PDA/NPDTA.h | 28 ++++++++++ .../PDA/RealTimeHeightDeterministicDPDA.h | 43 +++++++++++++++ .../PDA/RealTimeHeightDeterministicNPDA.h | 45 +++++++++++++++ alib2data/src/automaton/PDA/SinglePopDPDA.h | 25 +++++++++ alib2data/src/automaton/PDA/SinglePopNPDA.h | 27 +++++++++ .../src/automaton/PDA/VisiblyPushdownDPDA.h | 53 ++++++++++++++++++ .../src/automaton/PDA/VisiblyPushdownNPDA.h | 55 +++++++++++++++++++ 11 files changed, 392 insertions(+) diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index e08468bc77..ac1886daf3 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -205,6 +206,30 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::pair < StateType, std::vector < PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( transitions ) ) { + std::pair < DefaultStateType, std::vector < DefaultSymbolType > > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( transition.second.second ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + DPDA < > * res = new DPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h index 74078a4752..4fde07b4a0 100644 --- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -209,6 +210,37 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, DefaultStateType > new_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, StateType > && transition : std::make_moveable_map ( transitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ) ); + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < DefaultSymbolType, std::pair < std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > new_inputSymbolToPushdownStoreOperation; + for ( std::pair < InputSymbolType, std::pair < std::vector < InputSymbolType >, std::vector < InputSymbolType > > > && pushdownOperation : std::make_moveable_map ( inputSymbolToPushdownStoreOperation ) ) { + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) ); + std::vector < DefaultSymbolType > push = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) ); + + new_inputSymbolToPushdownStoreOperation.insert ( std::make_pair ( AutomatonNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) ), std::make_pair ( std::move ( pop ), std::move ( push ) ) ) ); + } + + InputDrivenDPDA < > * res = new InputDrivenDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + res->inputSymbolToPushdownStoreOperation = new_inputSymbolToPushdownStoreOperation; + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index 03646f62aa..45e28d8996 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -218,6 +219,37 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < DefaultStateType > > new_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ) ); + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < DefaultSymbolType, std::pair < std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > new_inputSymbolToPushdownStoreOperation; + for ( std::pair < InputSymbolType, std::pair < std::vector < InputSymbolType >, std::vector < InputSymbolType > > > && pushdownOperation : std::make_moveable_map ( inputSymbolToPushdownStoreOperation ) ) { + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) ); + std::vector < DefaultSymbolType > push = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) ); + + new_inputSymbolToPushdownStoreOperation.insert ( std::make_pair ( AutomatonNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) ), std::make_pair ( std::move ( pop ), std::move ( push ) ) ) ); + } + + InputDrivenNPDA < > * res = new InputDrivenNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + res->inputSymbolToPushdownStoreOperation = new_inputSymbolToPushdownStoreOperation; + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index 31e951592d..d0b75a5afe 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -203,6 +204,32 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::set < std::pair < StateType, std::vector < PushdownStoreSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > targets; + for ( std::pair < StateType, std::vector < PushdownStoreSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( target.second ) ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + NPDA < > * res = new NPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/NPDTA.h b/alib2data/src/automaton/PDA/NPDTA.h index 1b134ac3f5..bc625ac02e 100644 --- a/alib2data/src/automaton/PDA/NPDTA.h +++ b/alib2data/src/automaton/PDA/NPDTA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -227,6 +228,33 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > outputAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < OutputAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::set < std::tuple < DefaultStateType, std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::set < std::tuple < StateType, std::vector < PushdownStoreSymbolType >, std::vector < OutputSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::tuple < DefaultStateType, std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > targets; + for ( std::tuple < StateType, std::vector < PushdownStoreSymbolType >, std::vector < OutputSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( target ) ) ), AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 1 > ( target ) ) ), AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( target ) ) ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + NPDTA < > * res = new NPDTA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( outputAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index 0bd995e3b7..40cacc9c90 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -231,6 +232,48 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::pair < DefaultStateType, DefaultSymbolType > > new_call_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::pair < StateType, PushdownStoreSymbolType > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::pair < DefaultStateType, DefaultSymbolType > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.second.second ) ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, DefaultStateType > new_return_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, StateType > && transition : std::make_moveable_map ( returnTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultSymbolType popSymbol ( alib::AnyObject < PushdownStoreSymbolType > ( std::move ( std::get < 2 > ( transition.first ) ) ) ); + + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, DefaultStateType > new_local_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, StateType > && transition : std::make_moveable_map ( localTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + RealTimeHeightDeterministicDPDA < > * res = new RealTimeHeightDeterministicDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index ad866c4fe4..0a683c755b 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -272,6 +273,50 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + std::set < DefaultStateType > initialStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < InitialStates > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::set < std::pair < DefaultStateType, DefaultSymbolType > > > new_call_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::set < std::pair < StateType, PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::set < std::pair < DefaultStateType, DefaultSymbolType > > targets; + for ( std::pair < StateType, PushdownStoreSymbolType > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( target.second ) ) ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::set < DefaultStateType > > new_return_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( returnTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultSymbolType popSymbol ( alib::AnyObject < PushdownStoreSymbolType > ( std::move ( std::get < 2 > ( transition.first ) ) ) ); + + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::set < DefaultStateType > > new_local_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::set < StateType > > && transition : std::make_moveable_map ( localTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + RealTimeHeightDeterministicNPDA < > * res = new RealTimeHeightDeterministicNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialStates ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index c364ccb194..0922fb2d5b 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -25,6 +25,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -196,6 +197,30 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::pair < StateType, std::vector < PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( transitions ) ) { + std::pair < DefaultStateType, std::vector < DefaultSymbolType > > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( transition.second.second ) ) ); + + DefaultSymbolType pop = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + SinglePopDPDA < > * res = new SinglePopDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index 396de82830..27cbec3b47 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -203,6 +204,32 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::set < std::pair < StateType, std::vector < PushdownStoreSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > targets; + for ( std::pair < StateType, std::vector < PushdownStoreSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( target.second ) ) ) ); + + DefaultSymbolType pop = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + SinglePopNPDA < > * res = new SinglePopNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index 432f2b7317..59aada779b 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -22,6 +22,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -264,6 +265,58 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > call_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < CallAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > return_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < ReturnAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > local_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < LocalAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::pair < DefaultStateType, DefaultSymbolType > > new_call_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::pair < StateType, PushdownStoreSymbolType > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::pair < DefaultStateType, DefaultSymbolType > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.second.second ) ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::tuple < DefaultStateType, DefaultSymbolType, DefaultSymbolType >, DefaultStateType > new_return_transitions; + for ( std::pair < std::tuple < StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > && transition : std::make_moveable_map ( returnTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 1 > ( transition.first ) ) ); + DefaultSymbolType popSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + + auto key = std::make_tuple ( std::move ( fromState ), std::move ( inputSymbol ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, DefaultStateType > new_local_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, StateType > && transition : std::make_moveable_map ( localTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + VisiblyPushdownDPDA < > * res = new VisiblyPushdownDPDA < > ( std::move ( states ), std::move ( call_alphabet ), std::move ( return_alphabet ), std::move ( local_alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 41ef1c8b53..34eb428298 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -22,6 +22,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -299,6 +300,60 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > call_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < CallAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > return_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < ReturnAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > local_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < LocalAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + std::set < DefaultStateType > initialStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < InitialStates > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < std::pair < DefaultStateType, DefaultSymbolType > > > new_call_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < std::pair < StateType, PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::set < std::pair < DefaultStateType, DefaultSymbolType > > targets; + for ( std::pair < StateType, PushdownStoreSymbolType > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( target.second ) ) ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::tuple < DefaultStateType, DefaultSymbolType, DefaultSymbolType >, std::set < DefaultStateType > > new_return_transitions; + for ( std::pair < std::tuple < StateType, InputSymbolType, PushdownStoreSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( returnTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 1 > ( transition.first ) ) ); + DefaultSymbolType popSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + + auto key = std::make_tuple ( std::move ( fromState ), std::move ( inputSymbol ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < DefaultStateType > > new_local_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( localTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + VisiblyPushdownNPDA < > * res = new VisiblyPushdownNPDA < > ( std::move ( states ), std::move ( call_alphabet ), std::move ( return_alphabet ), std::move ( local_alphabet ), std::move ( pushdownAlphabet ), std::move ( initialStates ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > -- GitLab