safra: Add bisimulation option
* src/tests/safra.cc, src/twaalgos/safra.cc, src/twaalgos/safra.hh: Here.
This commit is contained in:
parent
64b27a9a26
commit
f29de22b8a
3 changed files with 13 additions and 5 deletions
|
|
@ -42,6 +42,7 @@ int help()
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
bool sim = false;
|
||||||
bool in_hoa = false;
|
bool in_hoa = false;
|
||||||
bool in_ltl = false;
|
bool in_ltl = false;
|
||||||
bool out_dot = true;
|
bool out_dot = true;
|
||||||
|
|
@ -74,6 +75,8 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[i], "-p", 2))
|
else if (!strncmp(argv[i], "-p", 2))
|
||||||
pretty_print = true;
|
pretty_print = true;
|
||||||
|
else if (!strncmp(argv[i], "-b", 2))
|
||||||
|
sim = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
|
|
@ -92,7 +95,7 @@ int main(int argc, char* argv[])
|
||||||
spot::translator trans(dict);
|
spot::translator trans(dict);
|
||||||
trans.set_pref(spot::postprocessor::Deterministic);
|
trans.set_pref(spot::postprocessor::Deterministic);
|
||||||
auto tmp = trans.run(f);
|
auto tmp = trans.run(f);
|
||||||
res = spot::tgba_determinisation(tmp, pretty_print);
|
res = spot::tgba_determinisation(tmp, sim, pretty_print);
|
||||||
f->destroy();
|
f->destroy();
|
||||||
}
|
}
|
||||||
else if (in_hoa)
|
else if (in_hoa)
|
||||||
|
|
@ -101,7 +104,7 @@ int main(int argc, char* argv[])
|
||||||
auto aut = spot::hoa_parse(input, pel, dict);
|
auto aut = spot::hoa_parse(input, pel, dict);
|
||||||
if (spot::format_hoa_parse_errors(std::cerr, input, pel))
|
if (spot::format_hoa_parse_errors(std::cerr, input, pel))
|
||||||
return 2;
|
return 2;
|
||||||
res = tgba_determinisation(aut->aut, pretty_print);
|
res = tgba_determinisation(aut->aut, sim, pretty_print);
|
||||||
}
|
}
|
||||||
res->merge_transitions();
|
res->merge_transitions();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "safra.hh"
|
#include "safra.hh"
|
||||||
#include "twaalgos/degen.hh"
|
#include "twaalgos/degen.hh"
|
||||||
|
#include "twaalgos/simulation.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +61,7 @@ namespace spot
|
||||||
std::ostringstream& os, std::vector<unsigned>& idx)
|
std::ostringstream& os, std::vector<unsigned>& idx)
|
||||||
{
|
{
|
||||||
std::string s = subscript(start);
|
std::string s = subscript(start);
|
||||||
os << '[' << s;
|
os << '{' << s;
|
||||||
std::vector<unsigned> new_idx;
|
std::vector<unsigned> new_idx;
|
||||||
std::vector<unsigned> todo;
|
std::vector<unsigned> todo;
|
||||||
unsigned next = -1U;
|
unsigned next = -1U;
|
||||||
|
|
@ -117,7 +118,7 @@ namespace spot
|
||||||
todo_next.clear();
|
todo_next.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << s << ']';
|
os << s << '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if lhs has a smaller nesting pattern than rhs
|
// Returns true if lhs has a smaller nesting pattern than rhs
|
||||||
|
|
@ -367,7 +368,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
twa_graph_ptr
|
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
|
// Degeneralize
|
||||||
const_twa_graph_ptr aut;
|
const_twa_graph_ptr aut;
|
||||||
|
|
@ -473,6 +475,8 @@ namespace spot
|
||||||
res->set_acceptance(sets, acc_cond::acc_code::parity(false, false, sets));
|
res->set_acceptance(sets, acc_cond::acc_code::parity(false, false, sets));
|
||||||
res->prop_deterministic(true);
|
res->prop_deterministic(true);
|
||||||
res->prop_state_based_acc(false);
|
res->prop_state_based_acc(false);
|
||||||
|
if (bisimulation)
|
||||||
|
res = simulation(res);
|
||||||
if (pretty_print)
|
if (pretty_print)
|
||||||
res->set_named_prop("state-names", print_debug(seen));
|
res->set_named_prop("state-names", print_debug(seen));
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
|
|
@ -73,5 +73,6 @@ namespace spot
|
||||||
|
|
||||||
SPOT_API twa_graph_ptr
|
SPOT_API twa_graph_ptr
|
||||||
tgba_determinisation(const const_twa_graph_ptr& aut,
|
tgba_determinisation(const const_twa_graph_ptr& aut,
|
||||||
|
bool bisimulation = false,
|
||||||
bool pretty_print = false);
|
bool pretty_print = false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue