hoa: output acc-name for several acceptance types

So far the HOA output would emit an acc-name only
for generalized-Buchi or inferior types (Buchi, all).
It now knows about none, co-Buchi, generalized-co-Buchi,
Rabin, Streett, and generalized-Rabin as well.

* src/twa/acc.cc, src/twa/acc.hh: Add detection code.
* src/twaalgos/hoa.cc: Use it.
* src/tests/remfin.test, src/tests/maskacc.test,
src/tests/complete.test, src/tests/sim3.test,
src/tests/ltl2dstar.test: Adjust tests.
* src/tests/hoaparse.test: Adjust and add more tests.
This commit is contained in:
Alexandre Duret-Lutz 2015-05-19 19:31:13 +02:00
parent 8e1c846984
commit d276f73eed
9 changed files with 371 additions and 15 deletions

View file

@ -501,12 +501,12 @@ namespace spot
return res;
}
template<class iterator>
static acc_code generalized_rabin(iterator begin, iterator end)
template<class Iterator>
static acc_code generalized_rabin(Iterator begin, Iterator end)
{
acc_cond::acc_code res = f();
unsigned n = 0;
for (iterator i = begin; i != end; ++i)
for (Iterator i = begin; i != end; ++i)
{
acc_cond::acc_code pair = fin({n++});
acc_cond::mark_t m = 0U;
@ -854,6 +854,28 @@ namespace spot
return uses_fin_acceptance_;
}
bool is_true() const
{
return code_.is_true();
}
bool is_false() const
{
return code_.is_false();
}
bool is_buchi() const
{
unsigned s = code_.size();
return num_ == 1 &&
s == 2 && code_[1].op == acc_op::Inf && code_[0].mark == all_sets();
}
bool is_co_buchi() const
{
return num_ == 1 && is_generalized_co_buchi();
}
void set_generalized_buchi()
{
set_acceptance(inf(all_sets()));
@ -866,6 +888,21 @@ namespace spot
(s == 2 && code_[1].op == acc_op::Inf && code_[0].mark == all_sets());
}
bool is_generalized_co_buchi() const
{
unsigned s = code_.size();
return (s == 2 &&
code_[1].op == acc_op::Fin && code_[0].mark == all_sets());
}
// Returns a number of pairs (>=0) if Rabin, or -1 else.
int is_rabin() const;
// Returns a number of pairs (>=0) if Streett, or -1 else.
int is_streett() const;
// Return the number of Inf in each pair.
bool is_generalized_rabin(std::vector<unsigned>& pairs) const;
static acc_code generalized_buchi(unsigned n)
{
mark_t m((1U << n) - 1);
@ -874,18 +911,6 @@ namespace spot
return acc_code::inf(m);
}
bool is_buchi() const
{
unsigned s = code_.size();
return num_ == 1 &&
s == 2 && code_[1].op == acc_op::Inf && code_[0].mark == all_sets();
}
bool is_true() const
{
return code_.is_true();
}
protected:
bool check_fin_acceptance() const;