Commit 4221e68d authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

rename tgba_run as twa_run

Part of #113.

* src/twaalgos/emptiness.cc, src/twaalgos/emptiness.hh (tgba_run):
Rename as ...
(twa_run): ... this.
* NEWS: Mention it.
* iface/ltsmin/modelcheck.cc, src/tests/complementation.cc,
src/tests/emptchk.cc, src/tests/ikwiad.cc, src/tests/randtgba.cc,
src/twa/twa.hh, src/twaalgos/bfssteps.cc, src/twaalgos/bfssteps.hh,
src/twaalgos/gtec/ce.cc, src/twaalgos/gtec/ce.hh,
src/twaalgos/gv04.cc, src/twaalgos/magic.cc, src/twaalgos/minimize.cc,
src/twaalgos/ndfs_result.hxx, src/twaalgos/projrun.cc,
src/twaalgos/projrun.hh, src/twaalgos/reducerun.cc,
src/twaalgos/reducerun.hh, src/twaalgos/replayrun.cc,
src/twaalgos/replayrun.hh, src/twaalgos/se05.cc, src/twaalgos/word.cc,
src/twaalgos/word.hh, wrap/python/ajax/spotcgi.in,
wrap/python/spot_impl.i: Adjust.
parent 4a91fccc
......@@ -52,6 +52,7 @@ New in spot 1.99.4a (not yet released)
ltl_simplifier -> tl_simplifier
tgba_statistics::transitions -> twa_statistics::edges
tgba_sub_statistics::sub_transitions -> twa_sub_statistics::transitions
tgba_run -> twa_run
Python:
......
......@@ -314,7 +314,7 @@ checked_main(int argc, char **argv)
else if (accepting_run)
{
spot::tgba_run_ptr run;
spot::twa_run_ptr run;
tm.start("computing accepting run");
try
{
......@@ -340,7 +340,7 @@ checked_main(int argc, char **argv)
tm.stop("reducing accepting run");
tm.start("printing accepting run");
spot::print_tgba_run(std::cout, product, run);
spot::print_twa_run(std::cout, product, run);
tm.stop("printing accepting run");
}
}
......
......@@ -248,7 +248,7 @@ int main(int argc, char* argv[])
if (auto run = res->accepting_run())
{
spot::print_dot(std::cout, ec->automaton());
spot::print_tgba_run(std::cout, ec->automaton(), run);
spot::print_twa_run(std::cout, ec->automaton(), run);
}
}
else
......
......@@ -161,7 +161,7 @@ main(int argc, char** argv)
std::cout << ce_found << " counterexample found\n";
if (auto run = res->accepting_run())
{
auto ar = spot::tgba_run_to_tgba(a, run);
auto ar = spot::twa_run_to_tgba(a, run);
spot::print_dot(std::cout, ar);
}
std::cout << '\n';
......
......@@ -1586,7 +1586,7 @@ checked_main(int argc, char** argv)
if (accepting_run_replay)
{
tm.start("replaying acc. run");
if (!spot::replay_tgba_run(std::cout, a,
if (!spot::replay_twa_run(std::cout, a,
run, true))
exit_code = 1;
tm.stop("replaying acc. run");
......@@ -1596,12 +1596,12 @@ checked_main(int argc, char** argv)
tm.start("printing accepting run");
if (graph_run_tgba_opt)
{
auto ar = spot::tgba_run_to_tgba(a, run);
auto ar = spot::twa_run_to_tgba(a, run);
spot::print_dot(std::cout, ar);
}
else
{
spot::print_tgba_run(std::cout, a, run);
spot::print_twa_run(std::cout, a, run);
}
tm.stop("printing accepting run");
}
......
......@@ -379,7 +379,7 @@ struct ar_stat
}
void
count(const spot::const_tgba_run_ptr& run)
count(const spot::const_twa_run_ptr& run)
{
int p = run->prefix.size();
int c = run->cycle.size();
......@@ -986,7 +986,7 @@ main(int argc, char** argv)
++n_non_empty;
if (opt_replay)
{
spot::tgba_run_ptr run;
spot::twa_run_ptr run;
bool done = false;
tm_ar.start(algo);
for (int count = opt_R;;)
......@@ -1026,7 +1026,7 @@ main(int argc, char** argv)
{
tm_ar.stop(algo);
std::ostringstream s;
if (!spot::replay_tgba_run(s,
if (!spot::replay_twa_run(s,
res->automaton(),
run))
{
......@@ -1051,7 +1051,7 @@ main(int argc, char** argv)
{
auto redrun =
spot::reduce_run(res->automaton(), run);
if (!spot::replay_tgba_run(s,
if (!spot::replay_twa_run(s,
res
->automaton(),
redrun))
......
......@@ -642,7 +642,7 @@ namespace spot
/// is the empty string.
///
/// This method is used for instance in print_dot(),
/// and replay_tgba_run().
/// and replay_twa_run().
///
/// \param t a non-done twa_succ_iterator for this automaton
virtual std::string
......
......@@ -38,20 +38,20 @@ namespace spot
}
void
bfs_steps::finalize(const std::map<const state*, tgba_run::step,
state_ptr_less_than>& father, const tgba_run::step& s,
const state* start, tgba_run::steps& l)
bfs_steps::finalize(const std::map<const state*, twa_run::step,
state_ptr_less_than>& father, const twa_run::step& s,
const state* start, twa_run::steps& l)
{
tgba_run::steps p;
tgba_run::step current = s;
twa_run::steps p;
twa_run::step current = s;
for (;;)
{
tgba_run::step tmp = current;
twa_run::step tmp = current;
tmp.s = tmp.s->clone();
p.push_front(tmp);
if (current.s == start)
break;
std::map<const state*, tgba_run::step,
std::map<const state*, twa_run::step,
state_ptr_less_than>::const_iterator it = father.find(current.s);
assert(it != father.end());
current = it->second;
......@@ -60,11 +60,11 @@ namespace spot
}
const state*
bfs_steps::search(const state* start, tgba_run::steps& l)
bfs_steps::search(const state* start, twa_run::steps& l)
{
// Records backlinks to parent state during the BFS.
// (This also stores the propositions of this link.)
std::map<const state*, tgba_run::step,
std::map<const state*, twa_run::step,
state_ptr_less_than> father;
// BFS queue.
std::deque<const state*> todo;
......@@ -84,7 +84,7 @@ namespace spot
bdd cond = i->current_condition();
acc_cond::mark_t acc = i->current_acceptance_conditions();
tgba_run::step s = { src, cond, acc };
twa_run::step s = { src, cond, acc };
if (match(s, dest))
{
......
......@@ -28,7 +28,7 @@
namespace spot
{
/// \ingroup twa_misc
/// \brief Make a BFS in a spot::tgba to compute a tgba_run::steps.
/// \brief Make a BFS in a spot::tgba to compute a twa_run::steps.
///
/// This class should be used to compute the shortest path
/// between a state of a spot::tgba and the first transition or
......@@ -48,7 +48,7 @@ namespace spot
///
/// \return the destination state of the last step (not included
/// in \a l) if a matching path was found, or 0 otherwise.
const state* search(const state* start, tgba_run::steps& l);
const state* search(const state* start, twa_run::steps& l);
/// \brief Return a state* that is unique for \a a.
///
......@@ -82,7 +82,7 @@ namespace spot
/// and when this happens the list argument of search() is be
/// augmented with the shortest past that ends with this
/// transition.
virtual bool match(tgba_run::step& step, const state* dest) = 0;
virtual bool match(twa_run::step& step, const state* dest) = 0;
/// \brief Append the resulting path to the resulting run.
///
......@@ -90,11 +90,11 @@ namespace spot
/// resulting path to \a l. This seldom needs to be overridden,
/// unless you do not want \a l to be updated (in which case an empty
/// finalize() will do).
virtual void finalize(const std::map<const state*, tgba_run::step,
virtual void finalize(const std::map<const state*, twa_run::step,
state_ptr_less_than>& father,
const tgba_run::step& s,
const twa_run::step& s,
const state* start,
tgba_run::steps& l);
twa_run::steps& l);
protected:
const_twa_ptr a_; ///< The spot::tgba we are searching into.
......
......@@ -34,10 +34,10 @@
namespace spot
{
// tgba_run
// twa_run
//////////////////////////////////////////////////////////////////////
tgba_run::~tgba_run()
twa_run::~twa_run()
{
for (auto i : prefix)
i.s->destroy();
......@@ -45,7 +45,7 @@ namespace spot
i.s->destroy();
}
tgba_run::tgba_run(const tgba_run& run)
twa_run::twa_run(const twa_run& run)
{
for (steps::const_iterator i = run.prefix.begin();
i != run.prefix.end(); ++i)
......@@ -61,28 +61,28 @@ namespace spot
}
}
tgba_run&
tgba_run::operator=(const tgba_run& run)
twa_run&
twa_run::operator=(const twa_run& run)
{
if (&run != this)
{
this->~tgba_run();
new(this) tgba_run(run);
this->~twa_run();
new(this) twa_run(run);
}
return *this;
}
// print_tgba_run
// print_twa_run
//////////////////////////////////////////////////////////////////////
std::ostream&
print_tgba_run(std::ostream& os,
print_twa_run(std::ostream& os,
const const_twa_ptr& a,
const const_tgba_run_ptr& run)
const const_twa_run_ptr& run)
{
bdd_dict_ptr d = a->get_dict();
os << "Prefix:" << std::endl;
for (tgba_run::steps::const_iterator i = run->prefix.begin();
for (twa_run::steps::const_iterator i = run->prefix.begin();
i != run->prefix.end(); ++i)
{
os << " " << a->format_state(i->s) << std::endl;
......@@ -93,7 +93,7 @@ namespace spot
os << std::endl;
}
os << "Cycle:" << std::endl;
for (tgba_run::steps::const_iterator i = run->cycle.begin();
for (twa_run::steps::const_iterator i = run->cycle.begin();
i != run->cycle.end(); ++i)
{
os << " " << a->format_state(i->s) << std::endl;
......@@ -109,7 +109,7 @@ namespace spot
// emptiness_check_result
//////////////////////////////////////////////////////////////////////
tgba_run_ptr
twa_run_ptr
emptiness_check_result::accepting_run()
{
return nullptr;
......@@ -287,11 +287,11 @@ namespace spot
return nullptr;
}
// tgba_run_to_tgba
// twa_run_to_tgba
//////////////////////////////////////////////////////////////////////
twa_graph_ptr
tgba_run_to_tgba(const const_twa_ptr& a, const const_tgba_run_ptr& run)
twa_run_to_tgba(const const_twa_ptr& a, const const_twa_run_ptr& run)
{
auto d = a->get_dict();
auto res = make_twa_graph(d);
......@@ -301,7 +301,7 @@ namespace spot
const state* s = a->get_init_state();
unsigned src;
unsigned dst;
const tgba_run::steps* l;
const twa_run::steps* l;
acc_cond::mark_t seen_acc = 0U;
typedef std::unordered_map<const state*, unsigned,
......@@ -313,7 +313,7 @@ namespace spot
else
l = &run->prefix;
tgba_run::steps::const_iterator i = l->begin();
twa_run::steps::const_iterator i = l->begin();
assert(s->compare(i->s) == 0);
src = res->new_state();
......
......@@ -32,9 +32,9 @@
namespace spot
{
struct tgba_run;
typedef std::shared_ptr<tgba_run> tgba_run_ptr;
typedef std::shared_ptr<const tgba_run> const_tgba_run_ptr;
struct twa_run;
typedef std::shared_ptr<twa_run> twa_run_ptr;
typedef std::shared_ptr<const twa_run> const_twa_run_ptr;
/// \addtogroup emptiness_check Emptiness-checks
/// \ingroup twa_algorithms
......@@ -64,7 +64,7 @@ namespace spot
///
/// The acceptance run returned by
/// spot::emptiness_check_result::accepting_run(), if any, is of
/// type spot::tgba_run. \ref tgba_run "This page" gathers existing
/// type spot::twa_run. \ref twa_run "This page" gathers existing
/// operations on these objects.
///
/// @{
......@@ -100,7 +100,7 @@ namespace spot
/// cannot produce a counter example (that does not mean there
/// is no counter-example; the mere existence of an instance of
/// this class asserts the existence of a counter-example).
virtual tgba_run_ptr accepting_run();
virtual twa_run_ptr accepting_run();
/// The automaton on which an accepting_run() was found.
const const_twa_ptr&
......@@ -263,7 +263,7 @@ namespace spot
/// @{
/// An accepted run, for a tgba.
struct SPOT_API tgba_run
struct SPOT_API twa_run
{
struct step {
const state* s;
......@@ -284,39 +284,39 @@ namespace spot
steps prefix;
steps cycle;
~tgba_run();
tgba_run()
~twa_run();
twa_run()
{
};
tgba_run(const tgba_run& run);
tgba_run& operator=(const tgba_run& run);
twa_run(const twa_run& run);
twa_run& operator=(const twa_run& run);
};
/// \brief Display a tgba_run.
/// \brief Display a twa_run.
///
/// Output the prefix and cycle parts of the tgba_run \a run on \a os.
/// Output the prefix and cycle parts of the twa_run \a run on \a os.
///
/// The automaton \a a is used only to format the states, and
/// to know how to print the BDDs describing the conditions and
/// acceptance conditions of the run; it is <b>not</b> used to
/// replay the run. In other words this function will work even if
/// the tgba_run you are trying to print appears to connect states
/// the twa_run you are trying to print appears to connect states
/// of \a a that are not connected.
///
/// This is unlike replay_tgba_run(), which will ensure the run
/// This is unlike replay_twa_run(), which will ensure the run
/// actually exists in the automaton (and will also display any
/// transition annotation).
SPOT_API std::ostream&
print_tgba_run(std::ostream& os,
print_twa_run(std::ostream& os,
const const_twa_ptr& a,
const const_tgba_run_ptr& run);
const const_twa_run_ptr& run);
/// \brief Return an explicit_tgba corresponding to \a run (i.e. comparable
/// states are merged).
///
/// \pre \a run must correspond to an actual run of the automaton \a a.
SPOT_API twa_graph_ptr
tgba_run_to_tgba(const const_twa_ptr& a, const const_tgba_run_ptr& run);
twa_run_to_tgba(const const_twa_ptr& a, const const_twa_run_ptr& run);
/// @}
......
......@@ -39,7 +39,7 @@ namespace spot
}
const state*
search(const state* start, tgba_run::steps& l)
search(const state* start, twa_run::steps& l)
{
return this->bfs_steps::search(filter(start), l);
}
......@@ -60,7 +60,7 @@ namespace spot
}
bool
match(tgba_run::step&, const state* dest)
match(twa_run::step&, const state* dest)
{
return target->find(dest) != target->end();
}
......@@ -91,10 +91,10 @@ namespace spot
return count;
}
tgba_run_ptr
twa_run_ptr
couvreur99_check_result::accepting_run()
{
run_ = std::make_shared<tgba_run>();
run_ = std::make_shared<twa_run>();
assert(!ecs_->root.empty());
......@@ -106,7 +106,7 @@ namespace spot
// Register all states from the cycle as target of the BFS.
state_set ss;
for (tgba_run::steps::const_iterator i = run_->cycle.begin();
for (twa_run::steps::const_iterator i = run_->cycle.begin();
i != run_->cycle.end(); ++i)
ss.insert(i->s);
shortest_path shpath(&ss, ecs_, this);
......@@ -132,7 +132,7 @@ namespace spot
}
// Locate cycle_entry_point on the cycle.
tgba_run::steps::iterator cycle_ep_it;
twa_run::steps::iterator cycle_ep_it;
for (cycle_ep_it = run_->cycle.begin();
cycle_ep_it != run_->cycle.end()
&& cycle_entry_point->compare(cycle_ep_it->s); ++cycle_ep_it)
......@@ -201,7 +201,7 @@ namespace spot
}
virtual bool
match(tgba_run::step& st, const state* s)
match(twa_run::step& st, const state* s)
{
acc_cond::mark_t less_acc =
acc_to_traverse - st.acc;
......
......@@ -38,7 +38,7 @@ namespace spot
std::shared_ptr<const couvreur99_check_status>& ecs,
option_map o = option_map());
virtual tgba_run_ptr accepting_run();
virtual twa_run_ptr accepting_run();
void print_stats(std::ostream& os) const;
......@@ -51,6 +51,6 @@ namespace spot
private:
std::shared_ptr<const couvreur99_check_status> ecs_;
tgba_run_ptr run_;
twa_run_ptr run_;
};
}
......@@ -284,10 +284,10 @@ namespace spot
return s;
}
virtual tgba_run_ptr
virtual twa_run_ptr
accepting_run()
{
auto res = std::make_shared<tgba_run>();
auto res = std::make_shared<twa_run>();
update_lowlinks();
#ifdef TRACE
......@@ -309,7 +309,7 @@ namespace spot
int father = data.stack[scc_root].pre;
while (father >= 0)
{
tgba_run::step st =
twa_run::step st =
{
data.stack[father].s->clone(),
data.stack[father].lasttr->current_condition(),
......@@ -360,7 +360,7 @@ namespace spot
}
virtual bool
match(tgba_run::step& step, const state*)
match(twa_run::step& step, const state*)
{
return step.acc != 0U;
}
......@@ -375,7 +375,7 @@ namespace spot
}
virtual bool
match(tgba_run::step&, const state* s)
match(twa_run::step&, const state* s)
{
return s == target;
}
......
......@@ -328,15 +328,15 @@ namespace spot
{
}
virtual tgba_run_ptr accepting_run()
virtual twa_run_ptr accepting_run()
{
assert(!ms_->st_blue.empty());
assert(!ms_->st_red.empty());
auto run = std::make_shared<tgba_run>();
auto run = std::make_shared<twa_run>();
typename stack_type::const_reverse_iterator i, j, end;
tgba_run::steps* l;
twa_run::steps* l;
l = &run->prefix;
......@@ -345,21 +345,21 @@ namespace spot
j = i; ++j;
for (; i != end; ++i, ++j)
{
tgba_run::step s = { i->s->clone(), j->label, j->acc };
twa_run::step s = { i->s->clone(), j->label, j->acc };
l->push_back(s);
}
l = &run->cycle;
j = ms_->st_red.rbegin();
tgba_run::step s = { i->s->clone(), j->label, j->acc };
twa_run::step s = { i->s->clone(), j->label, j->acc };
l->push_back(s);
i = j; ++j;
end = ms_->st_red.rend(); --end;
for (; i != end; ++i, ++j)
{
tgba_run::step s = { i->s->clone(), j->label, j->acc };
twa_run::step s = { i->s->clone(), j->label, j->acc };
l->push_back(s);
}
......@@ -408,7 +408,7 @@ namespace spot
delete computer;
}
virtual tgba_run_ptr accepting_run()
virtual twa_run_ptr accepting_run()
{
return computer->accepting_run();
}
......
......@@ -197,7 +197,7 @@ namespace spot
}
virtual bool
match(tgba_run::step&, const state* to)
match(twa_run::step&, const state* to)
{
return to == dest;
}
......@@ -220,14 +220,14 @@ namespace spot
// Find a loop around START in SCC #n.
wdba_search_acc_loop wsal(det_a, scc_n, sm, pm, start);
tgba_run::steps loop;
twa_run::steps loop;
const state* reached = wsal.search(start, loop);
assert(reached == start);
(void)reached;
// Build an automaton representing this loop.
auto loop_a = make_twa_graph(det_a->get_dict());
tgba_run::steps::const_iterator i;
twa_run::steps::const_iterator i;
int loop_size = loop.size();
loop_a->new_states(loop_size);
int n;
......
......@@ -104,7 +104,7 @@ namespace spot
{
}
virtual tgba_run_ptr accepting_run()
virtual twa_run_ptr accepting_run()
{
const stack_type& stb = ms_->get_st_blue();
const stack_type& str = ms_->get_st_red();
......@@ -194,7 +194,7 @@ namespace spot
assert(!acc_trans.empty());
auto run = std::make_shared<tgba_run>();
auto run = std::make_shared<twa_run>();
// construct run->cycle from acc_trans.
construct_cycle(run, acc_trans);
// construct run->prefix (a minimal path from the initial state to any
......@@ -389,7 +389,7 @@ namespace spot
}
}
const state* search(const state* start, tgba_run::steps& l)
const state* search(const state* start, twa_run::steps& l)
{
const state* s = filter(start);