Commit f29de22b authored by Alexandre Lewkowicz's avatar Alexandre Lewkowicz Committed by Alexandre Duret-Lutz
Browse files

safra: Add bisimulation option

* src/tests/safra.cc, src/twaalgos/safra.cc,
src/twaalgos/safra.hh: Here.
parent 64b27a9a
......@@ -42,6 +42,7 @@ int help()
int main(int argc, char* argv[])
{
bool sim = false;
bool in_hoa = false;
bool in_ltl = false;
bool out_dot = true;
......@@ -74,6 +75,8 @@ int main(int argc, char* argv[])
}
else if (!strncmp(argv[i], "-p", 2))
pretty_print = true;
else if (!strncmp(argv[i], "-b", 2))
sim = true;
}
if (!input)
......@@ -92,7 +95,7 @@ int main(int argc, char* argv[])
spot::translator trans(dict);
trans.set_pref(spot::postprocessor::Deterministic);
auto tmp = trans.run(f);
res = spot::tgba_determinisation(tmp, pretty_print);
res = spot::tgba_determinisation(tmp, sim, pretty_print);
f->destroy();
}
else if (in_hoa)
......@@ -101,7 +104,7 @@ int main(int argc, char* argv[])
auto aut = spot::hoa_parse(input, pel, dict);
if (spot::format_hoa_parse_errors(std::cerr, input, pel))
return 2;
res = tgba_determinisation(aut->aut, pretty_print);
res = tgba_determinisation(aut->aut, sim, pretty_print);
}
res->merge_transitions();
......
......@@ -24,6 +24,7 @@
#include "safra.hh"
#include "twaalgos/degen.hh"
#include "twaalgos/simulation.hh"
namespace spot
{
......@@ -60,7 +61,7 @@ namespace spot
std::ostringstream& os, std::vector<unsigned>& idx)
{
std::string s = subscript(start);
os << '[' << s;
os << '{' << s;
std::vector<unsigned> new_idx;
std::vector<unsigned> todo;
unsigned next = -1U;
......@@ -117,7 +118,7 @@ namespace spot
todo_next.clear();
}
}
os << s << ']';
os << s << '}';
}
// Returns true if lhs has a smaller nesting pattern than rhs
......@@ -367,7 +368,8 @@ namespace spot
}
twa_graph_ptr
tgba_determinisation(const const_twa_graph_ptr& a, bool pretty_print)
tgba_determinisation(const const_twa_graph_ptr& a, bool bisimulation,
bool pretty_print)
{
// Degeneralize
const_twa_graph_ptr aut;
......@@ -473,6 +475,8 @@ namespace spot
res->set_acceptance(sets, acc_cond::acc_code::parity(false, false, sets));
res->prop_deterministic(true);
res->prop_state_based_acc(false);
if (bisimulation)
res = simulation(res);
if (pretty_print)
res->set_named_prop("state-names", print_debug(seen));
return res;
......
......@@ -73,5 +73,6 @@ namespace spot
SPOT_API twa_graph_ptr
tgba_determinisation(const const_twa_graph_ptr& aut,
bool bisimulation = false,
bool pretty_print = false);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment