Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
AutomatonCompare.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "automaton/FSM/DFA.h"
9#include "automaton/FSM/NFA.h"
15#include "automaton/TA/DFTA.h"
16#include "automaton/TA/NFTA.h"
17#include "automaton/PDA/NPDA.h"
18#include "automaton/PDA/DPDA.h"
28
29namespace compare {
30
32public:
33 template<class SymbolType, class StateType>
35
36 template<class SymbolType, class StateType>
38
39 template<class SymbolType, class StateType>
41
42 template<class SymbolType, class StateType>
44
45 template<class SymbolType, class StateType>
47
48 template<class SymbolType, class StateType>
50
51 template<class SymbolType, class StateType>
53
54 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
56
57 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
59
60 template<class SymbolType, class StateType>
62
63 template<class SymbolType, class StateType>
65
66 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
68
69 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
71
72 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
74
75 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
77
78 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
80
81 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
83
84 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
86
87 template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
89
90 template<class SymbolType, class StateType>
92};
93
94template<class SymbolType, class StateType>
96 return a.getFinalStates() == b.getFinalStates() &&
98// a.getInputAlphabet() == b.getInputAlphabet() &&
99 a.getStates() == b.getStates() &&
100 a.getTransitions() == b.getTransitions() ;
101}
102
103template<class SymbolType, class StateType>
105 return a.getFinalStates() == b.getFinalStates() &&
107// a.getInputAlphabet() == b.getInputAlphabet() &&
108 a.getStates() == b.getStates() &&
109 a.getTransitions() == b.getTransitions() ;
110}
111
112template<class SymbolType, class StateType>
114 return a.getFinalStates() == b.getFinalStates() &&
115 a.getInitialState() == b.getInitialState() &&
116// a.getInputAlphabet() == b.getInputAlphabet() &&
117 a.getStates() == b.getStates() &&
118 a.getTransitions() == b.getTransitions() ;
119}
120
121template<class SymbolType, class StateType>
123 return a.getFinalStates() == b.getFinalStates() &&
124 a.getInitialState() == b.getInitialState() &&
125// a.getInputAlphabet() == b.getInputAlphabet() &&
126 a.getStates() == b.getStates() &&
127 a.getTransitions() == b.getTransitions() ;
128}
129
130template<class SymbolType, class StateType>
132 return a.getFinalStates() == b.getFinalStates() &&
133 a.getInitialState() == b.getInitialState() &&
134// a.getInputAlphabet() == b.getInputAlphabet() &&
135 a.getStates() == b.getStates() &&
136 a.getTransitions() == b.getTransitions() ;
137}
138
139template<class SymbolType, class StateType>
141 return a.getFinalStates() == b.getFinalStates() &&
142 a.getInitialState() == b.getInitialState() &&
143// a.getInputAlphabet() == b.getInputAlphabet() &&
144 a.getStates() == b.getStates() &&
145 a.getTransitions() == b.getTransitions() ;
146}
147
148template<class SymbolType, class StateType>
150 return a.getFinalStates() == b.getFinalStates() &&
151 a.getInitialState() == b.getInitialState() &&
152// a.getInputAlphabet() == b.getInputAlphabet() &&
153 a.getStates() == b.getStates() &&
154 a.getTransitions() == b.getTransitions() ;
155}
156
157template<class SymbolType, class StateType>
159 return a.getFinalStates() == b.getFinalStates() &&
160// a.getInputAlphabet() == b.getInputAlphabet() &&
161 a.getStates() == b.getStates() &&
162 a.getTransitions() == b.getTransitions() ;
163}
164
165template<class SymbolType, class StateType>
167 return a.getFinalStates() == b.getFinalStates() &&
168// a.getInputAlphabet() == b.getInputAlphabet() &&
169 a.getStates() == b.getStates() &&
170 a.getTransitions() == b.getTransitions() ;
171}
172
173template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
175 return a.getFinalStates() == b.getFinalStates() &&
176 a.getInitialState() == b.getInitialState() &&
177// a.getInputAlphabet() == b.getInputAlphabet() &&
178// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
180 a.getStates() == b.getStates() &&
181 a.getTransitions() == b.getTransitions() ;
182}
183
184template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
186 return a.getFinalStates() == b.getFinalStates() &&
187 a.getInitialState() == b.getInitialState() &&
188// a.getInputAlphabet() == b.getInputAlphabet() &&
189// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
191 a.getStates() == b.getStates() &&
192 a.getTransitions() == b.getTransitions() ;
193}
194
195template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
197 return a.getFinalStates() == b.getFinalStates() &&
198 a.getInitialState() == b.getInitialState() &&
199// a.getInputAlphabet() == b.getInputAlphabet() &&
200// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
202 a.getStates() == b.getStates() &&
204 a.getTransitions() == b.getTransitions() ;
205}
206
207template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
209 return a.getFinalStates() == b.getFinalStates() &&
210 a.getInitialState() == b.getInitialState() &&
211// a.getInputAlphabet() == b.getInputAlphabet() &&
212// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
214 a.getStates() == b.getStates() &&
216 a.getTransitions() == b.getTransitions() ;
217}
218
219template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
221 return a.getFinalStates() == b.getFinalStates() &&
222 a.getInitialState() == b.getInitialState() &&
223// a.getCallInputAlphabet() == b.getCallInputAlphabet() &&
224// a.getReturnnputAlphabet() == b.getReturnInputAlphabet() &&
225// a.getLocalInputAlphabet() == b.getLocalInputAlphabet() &&
226// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
228 a.getStates() == b.getStates() &&
232}
233
234template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
236 return a.getFinalStates() == b.getFinalStates() &&
238// a.getCallInputAlphabet() == b.getCallInputAlphabet() &&
239// a.getReturnnputAlphabet() == b.getReturnInputAlphabet() &&
240// a.getLocalInputAlphabet() == b.getLocalInputAlphabet() &&
241// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
243 a.getStates() == b.getStates() &&
247}
248
249template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
251 return a.getFinalStates() == b.getFinalStates() &&
252 a.getInitialState() == b.getInitialState() &&
253// a.getInputAlphabet() == b.getInputAlphabet() &&
254// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
256 a.getStates() == b.getStates() &&
260}
261
262template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
264 return a.getFinalStates() == b.getFinalStates() &&
266// a.getInputAlphabet() == b.getInputAlphabet() &&
267// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
269 a.getStates() == b.getStates() &&
273}
274
275template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
277 return a.getFinalStates() == b.getFinalStates() &&
278 a.getInitialState() == b.getInitialState() &&
279// a.getInputAlphabet() == b.getInputAlphabet() &&
280// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
282 a.getStates() == b.getStates() &&
283 a.getTransitions() == b.getTransitions() ;
284}
285
286template<class InputSymbolType, class PushdownStoreSymbolType, class StateType>
288 return a.getFinalStates() == b.getFinalStates() &&
289 a.getInitialState() == b.getInitialState() &&
290// a.getInputAlphabet() == b.getInputAlphabet() &&
291// a.getPushdownStoreAlphabet() == b.getPushdownStoreAlphabet() &&
293 a.getStates() == b.getStates() &&
294 a.getTransitions() == b.getTransitions() ;
295}
296
297template<class SymbolType, class StateType>
299 return a.getBlankSymbol() == b.getBlankSymbol() &&
300 a.getFinalStates() == b.getFinalStates() &&
301 a.getInitialState() == b.getInitialState() &&
302// a.getInputAlphabet() == b.getInputAlphabet() &&
303 a.getStates() == b.getStates() &&
304// a.getTapeAlphabet() == b.getTapeAlphabet() &&
305 a.getTransitions() == b.getTransitions() ;
306}
307
308} /* namespace compare */
309
Compact deterministic finite automaton. Accepts regular languages. The automaton has a list of symbol...
Definition: CompactDFA.h:73
const ext::map< ext::pair< StateType, ext::vector< SymbolType > >, StateType > & getTransitions() const &
Definition: CompactDFA.h:483
const ext::set< StateType > & getFinalStates() const &
Definition: CompactDFA.h:192
const StateType & getInitialState() const &
Definition: CompactDFA.h:114
const ext::set< StateType > & getStates() const &
Definition: CompactDFA.h:143
Compact nondeterministic finite automaton. Accepts regular languages. The automaton has a list of sym...
Definition: CompactNFA.h:78
const ext::set< StateType > & getFinalStates() const &
Definition: CompactNFA.h:232
const ext::multimap< ext::pair< StateType, ext::vector< SymbolType > >, StateType > & getTransitions() const &
Definition: CompactNFA.h:555
const ext::set< StateType > & getStates() const &
Definition: CompactNFA.h:183
const StateType & getInitialState() const &
Definition: CompactNFA.h:154
Deterministic finite automaton. Accepts regular languages.
Definition: DFA.h:71
const ext::set< StateType > & getFinalStates() const &
Definition: DFA.h:183
const ext::map< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: DFA.h:473
const StateType & getInitialState() const &
Definition: DFA.h:105
const ext::set< StateType > & getStates() const &
Definition: DFA.h:134
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: DFTA.h:74
const ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > & getTransitions() const &
Definition: DFTA.h:289
const ext::set< StateType > & getFinalStates() const &
Definition: DFTA.h:154
const ext::set< StateType > & getStates() const &
Definition: DFTA.h:105
Deterministic pushdown automaton. Accepts subset of context free languages.
Definition: DPDA.h:78
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: DPDA.h:301
const ext::set< StateType > & getStates() const &
Definition: DPDA.h:145
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, ext::vector< PushdownStoreSymbolType > >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: DPDA.h:682
const ext::set< StateType > & getFinalStates() const &
Definition: DPDA.h:194
const StateType & getInitialState() const &
Definition: DPDA.h:116
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition: EpsilonNFA.h:74
const ext::set< StateType > & getStates() const &
Definition: EpsilonNFA.h:158
const ext::set< StateType > & getFinalStates() const &
Definition: EpsilonNFA.h:207
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > & getTransitions() const &
Definition: EpsilonNFA.h:666
const StateType & getInitialState() const &
Definition: EpsilonNFA.h:129
Extended nondeterministic finite automaton. Accepts regular languages. The automaton has a regular ex...
Definition: ExtendedNFA.h:80
const StateType & getInitialState() const &
Definition: ExtendedNFA.h:156
const ext::multimap< ext::pair< StateType, regexp::UnboundedRegExpStructure< SymbolType > >, StateType > & getTransitions() const &
Definition: ExtendedNFA.h:581
const ext::set< StateType > & getStates() const &
Definition: ExtendedNFA.h:185
const ext::set< StateType > & getFinalStates() const &
Definition: ExtendedNFA.h:234
Deterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenDPDA.h:79
const ext::map< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenDPDA.h:655
const ext::set< StateType > & getStates() const &
Definition: InputDrivenDPDA.h:160
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: InputDrivenDPDA.h:316
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenDPDA.h:209
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenDPDA.h:604
const StateType & getInitialState() const &
Definition: InputDrivenDPDA.h:131
Nondeterministic input driven pushdown automaton. Accepts subset of context free languages.
Definition: InputDrivenNPDA.h:79
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: InputDrivenNPDA.h:316
const ext::map< InputSymbolType, ext::pair< ext::vector< PushdownStoreSymbolType >, ext::vector< PushdownStoreSymbolType > > > & getPushdownStoreOperations() const &
Definition: InputDrivenNPDA.h:614
const ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > & getTransitions() const &
Definition: InputDrivenNPDA.h:661
const ext::set< StateType > & getFinalStates() const &
Definition: InputDrivenNPDA.h:209
const StateType & getInitialState() const &
Definition: InputDrivenNPDA.h:131
const ext::set< StateType > & getStates() const &
Definition: InputDrivenNPDA.h:160
Nondeterministic finite automaton with multiple initial states. Accepts regular languages.
Definition: MultiInitialStateNFA.h:69
const ext::set< StateType > & getInitialStates() const &
Definition: MultiInitialStateNFA.h:117
const ext::set< StateType > & getStates() const &
Definition: MultiInitialStateNFA.h:166
const ext::multimap< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: MultiInitialStateNFA.h:520
const ext::set< StateType > & getFinalStates() const &
Definition: MultiInitialStateNFA.h:215
Nondeterministic finite automaton. Accepts regular languages.
Definition: NFA.h:66
const ext::set< StateType > & getStates() const &
Definition: NFA.h:136
const StateType & getInitialState() const &
Definition: NFA.h:107
const ext::multimap< ext::pair< StateType, SymbolType >, StateType > & getTransitions() const &
Definition: NFA.h:484
const ext::set< StateType > & getFinalStates() const &
Definition: NFA.h:185
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: NFTA.h:72
const ext::set< StateType > & getFinalStates() const &
Definition: NFTA.h:159
const ext::multimap< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > & getTransitions() const &
Definition: NFTA.h:294
const ext::set< StateType > & getStates() const &
Definition: NFTA.h:110
Definition: NPDA.h:74
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: NPDA.h:304
const ext::set< StateType > & getFinalStates() const &
Definition: NPDA.h:197
const StateType & getInitialState() const &
Definition: NPDA.h:119
const ext::set< StateType > & getStates() const &
Definition: NPDA.h:148
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
Deterministic single tape turing machine. Accepts recursive languages.
Definition: OneTapeDTM.h:71
const StateType & getInitialState() const &
Definition: OneTapeDTM.h:108
const ext::set< StateType > & getFinalStates() const &
Definition: OneTapeDTM.h:186
const ext::map< ext::pair< StateType, SymbolType >, ext::tuple< StateType, SymbolType, Shift > > & getTransitions() const &
Definition: OneTapeDTM.h:526
const SymbolType & getBlankSymbol() const &
Definition: OneTapeDTM.h:351
const ext::set< StateType > & getStates() const &
Definition: OneTapeDTM.h:137
Deterministic real time height deterministic pushdown automaton. Accepts subset of context free langu...
Definition: RealTimeHeightDeterministicDPDA.h:89
const StateType & getInitialState() const &
Definition: RealTimeHeightDeterministicDPDA.h:149
const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1062
const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & getLocalTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1082
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: RealTimeHeightDeterministicDPDA.h:1072
const ext::set< StateType > & getStates() const &
Definition: RealTimeHeightDeterministicDPDA.h:178
const ext::set< StateType > & getFinalStates() const &
Definition: RealTimeHeightDeterministicDPDA.h:227
const PushdownStoreSymbolType & getBottomOfTheStackSymbol() const &
Definition: RealTimeHeightDeterministicDPDA.h:334
Nondeterministic real time height deterministic pushdown automaton. Accepts subset of context free la...
Definition: RealTimeHeightDeterministicNPDA.h:76
const ext::set< StateType > & getInitialStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:175
const PushdownStoreSymbolType & getBottomOfTheStackSymbol() const &
Definition: RealTimeHeightDeterministicNPDA.h:331
const ext::set< StateType > & getStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:126
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & getLocalTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:1004
const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:984
const ext::set< StateType > & getFinalStates() const &
Definition: RealTimeHeightDeterministicNPDA.h:224
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: RealTimeHeightDeterministicNPDA.h:994
Deterministic pushdown automaton requiring a symbol pop from pushdown store on each transition use....
Definition: SinglePopDPDA.h:78
const StateType & getInitialState() const &
Definition: SinglePopDPDA.h:116
const ext::set< StateType > & getFinalStates() const &
Definition: SinglePopDPDA.h:194
const ext::set< StateType > & getStates() const &
Definition: SinglePopDPDA.h:145
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: SinglePopDPDA.h:301
const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: SinglePopDPDA.h:639
Definition: SinglePopNPDA.h:72
const StateType & getInitialState() const &
Definition: SinglePopNPDA.h:110
const PushdownStoreSymbolType & getInitialSymbol() const &
Definition: SinglePopNPDA.h:295
const ext::multimap< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, ext::pair< StateType, ext::vector< PushdownStoreSymbolType > > > & getTransitions() const &
Definition: SinglePopNPDA.h:617
const ext::set< StateType > & getStates() const &
Definition: SinglePopNPDA.h:139
const ext::set< StateType > & getFinalStates() const &
Definition: SinglePopNPDA.h:188
Deterministic visibly pushdown automaton. Accepts subset of context free languages.
Definition: VisiblyPushdownDPDA.h:86
const PushdownStoreSymbolType & getBottomOfTheStackSymbol() const &
Definition: VisiblyPushdownDPDA.h:331
const ext::map< ext::tuple< StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: VisiblyPushdownDPDA.h:899
const ext::map< ext::pair< StateType, InputSymbolType >, StateType > & getLocalTransitions() const &
Definition: VisiblyPushdownDPDA.h:909
const ext::set< StateType > & getFinalStates() const &
Definition: VisiblyPushdownDPDA.h:224
const ext::map< ext::pair< StateType, InputSymbolType >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: VisiblyPushdownDPDA.h:889
const ext::set< StateType > & getStates() const &
Definition: VisiblyPushdownDPDA.h:175
const StateType & getInitialState() const &
Definition: VisiblyPushdownDPDA.h:146
Nondeterministic visibly pushdown automaton. Accepts subset of context free languages.
Definition: VisiblyPushdownNPDA.h:81
const PushdownStoreSymbolType & getBottomOfTheStackSymbol() const &
Definition: VisiblyPushdownNPDA.h:336
const ext::set< StateType > & getInitialStates() const &
Definition: VisiblyPushdownNPDA.h:131
const ext::set< StateType > & getStates() const &
Definition: VisiblyPushdownNPDA.h:180
const ext::multimap< ext::pair< StateType, InputSymbolType >, StateType > & getLocalTransitions() const &
Definition: VisiblyPushdownNPDA.h:884
const ext::set< StateType > & getFinalStates() const &
Definition: VisiblyPushdownNPDA.h:229
const ext::multimap< ext::tuple< StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > & getReturnTransitions() const &
Definition: VisiblyPushdownNPDA.h:874
const ext::multimap< ext::pair< StateType, InputSymbolType >, ext::pair< StateType, PushdownStoreSymbolType > > & getCallTransitions() const &
Definition: VisiblyPushdownNPDA.h:864
Definition: AutomatonCompare.h:31
static bool compare(const automaton::DFA< SymbolType, StateType > &a, const automaton::DFA< SymbolType, StateType > &b)
Definition: AutomatonCompare.h:95
Definition: AutomatonCompare.h:29