27 std::cout <<
"NTA:\n";
35 std::cout <<
"DTA:\n";
53 alphabet.insert(succs.begin(), succs.end());
77 std::cout <<
"Adding path: ";
80 for(
const auto &step : path)
85 std::cout <<
", " << l->location_number <<
':'
86 << l->source_location().as_string();
104 std::cout <<
"Final state: " << state <<
'\n';
118 std::cout <<
"Determinising automaton with " <<
nta.
num_states
133 std::cout <<
"There are " << init_states.size() <<
" init states\n";
144 "Removed state has actually been removed");
153 for(alphabett::iterator it=
alphabet.begin();
175 std::cout <<
"Produced DTA with " <<
dta.
num_states <<
" states and "
192 std::vector<statet> queue(states.size());
195 for(state_sett::iterator it=states.begin();
199 queue.push_back(*it);
203 while(!queue.empty())
205 statet state=queue.back();
213 for(state_sett::iterator it=next_states.begin();
214 it!=next_states.end();
217 if(states.find(*it)==states.end())
221 queue.push_back(*it);
246 "Added state has actually been added");
248 for(state_sett::iterator it=s.begin();
255 std::cout <<
"NTA state " << *it
256 <<
" is accepting, so accepting DTA state "
257 << state_num <<
'\n';
270 state_mapt::iterator it=
dstates.find(s);
301 trans.insert(std::make_pair(a, t));
329 for(transitionst::iterator it=range.first;
333 t.insert(it->second);
342 for(
const auto &state : s)
350 for(std::size_t i=0; i<dtrans.size(); ++i)
354 for(
const auto &trans : dta_transitions)
357 unsigned int j=trans.second;
361 transitions.insert(std::make_pair(l, state_pair));
373 for(std::size_t i=0; i<old_table.size(); i++)
397 std::cout <<
"Reversing automaton, old init=" <<
init_state
398 <<
", new init=" << new_init <<
", old accept="
407 for(std::size_t i=0; i<old_table.size(); i++)
411 for(
const auto &t : trans)
414 unsigned int j=t.second;
435 for(
const auto &s : new_states)
439 for(
const auto &t : trans)
441 unsigned int j=t.second;
443 if(reachable.find(j)==reachable.end())
451 tmp.swap(new_states);
453 while(!new_states.empty());
457 if(reachable.find(i)==reachable.end())
480 str <<
"Accept states: ";
494 str << i <<
" -- " << l->location_number <<
" --> " << j <<
'\n';
bool is_accepting(statet s)
std::vector< transitionst > transition_tablet
static const statet no_state
void set_accepting(statet s)
transition_tablet transitions
std::pair< transitionst::iterator, transitionst::iterator > transition_ranget
void output(std::ostream &str) const
void move(statet s, goto_programt::targett a, state_sett &t)
void swap(automatont &that)
void reverse(goto_programt::targett epsilon)
void add_trans(statet s, goto_programt::targett a, statet t)
std::size_t count_transitions()
std::multimap< goto_programt::targett, statet, goto_programt::target_less_than > transitionst
A generic container class for the GOTO intermediate representation of one function.
instructionst::iterator targett
std::list< Target > get_successors(Target target) const
Get control-flow successors of a given instruction.
bool in_alphabet(goto_programt::targett t)
goto_programt::targett epsilon
void get_transitions(sym_mapt &transitions)
statet find_dstate(state_sett &s)
void add_dtrans(state_sett &s, goto_programt::targett a, state_sett &t)
statet add_dstate(state_sett &s)
void build_alphabet(goto_programt &program)
std::multimap< goto_programt::targett, state_pairt, goto_programt::target_less_than > sym_mapt
std::vector< state_sett > unmarked_dstates
std::pair< statet, statet > state_pairt
void add_path(patht &path)
void epsilon_closure(state_sett &s)
void pop_unmarked_dstate(state_sett &s)
#define Forall_goto_program_instructions(it, program)
std::list< path_nodet > patht
#define CHECK_RETURN(CONDITION)
#define PRECONDITION(CONDITION)
std::set< statet > state_sett