hoa: output "unambiguous" only for non-deterministic automata by default

* src/twaalgos/hoa.cc: Output do not output "unambiguous" if the
automaton is deterministic.  Add option "v" to cancel this restriction,
and also output "no-univ-branch".
* src/twaalgos/hoa.hh: Document the "v" option.
* src/tests/readsave.test: Test it.
* src/tests/unambig.test: Adjust for unambiguous not being output
if the automaton is deterministic.
* src/bin/common_aoutput.cc, NEWS: Document it.
* doc/org/hoa.org: Add a summary table about how properties are handled.
* src/twa/twa.hh (prop_deterministic): Setting this should also
set the unambiguous property.
* src/twaalgos/isunamb.cc: Simplify the property check.
This commit is contained in:
Alexandre Duret-Lutz 2015-11-05 18:32:37 +01:00
parent 30037b9905
commit 33c234da11
9 changed files with 106 additions and 8 deletions

View file

@ -243,6 +243,7 @@ namespace spot
bool newline = true;
hoa_acceptance acceptance = Hoa_Acceptance_States;
bool implicit_labels = false;
bool verbose = false;
if (opt)
while (*opt)
@ -264,6 +265,9 @@ namespace spot
case 't':
acceptance = Hoa_Acceptance_Transitions;
break;
case 'v':
verbose = true;
break;
default:
throw std::runtime_error
(std::string("unknown option for print_hoa(): ") + c);
@ -387,6 +391,13 @@ namespace spot
}
os << str;
};
// We do not support alternating automata so far, and it's
// probable that nobody cares about the "no-univ-branch"
// properties. The "univ-branch" properties seems more important
// to announce that the automaton might not be parsable by tools
// that do not support alternating automata.
if (verbose)
prop(" no-univ-branch");
implicit_labels = md.use_implicit_labels;
if (implicit_labels)
prop(" implicit-labels");
@ -402,7 +413,12 @@ namespace spot
prop(" complete");
if (md.is_deterministic)
prop(" deterministic");
if (aut->prop_unambiguous())
// Deterministic automata are also unambiguous, so writing both
// properties seems redundant. People working on unambiguous
// automata are usually concerned about non-deterministic
// unambiguous automata. So do not mention "unambiguous"
// in the case of deterministic automata.
if (aut->prop_unambiguous() && (verbose || !md.is_deterministic))
prop(" unambiguous");
assert(!(aut->prop_stutter_invariant() && aut->prop_stutter_sensitive()));
if (aut->prop_stutter_invariant())

View file

@ -34,7 +34,7 @@ namespace spot
/// option: (i) implicit labels for complete and
/// deterministic automata, (s) state-based acceptance, (t)
/// transition-based acceptance, (m) mixed acceptance, (l)
/// single-line output.
/// single-line output, (v) verbose properties.
SPOT_API std::ostream&
print_hoa(std::ostream& os,
const const_twa_ptr& g,

View file

@ -27,7 +27,7 @@ namespace spot
{
bool is_unambiguous(const const_twa_graph_ptr& aut)
{
if (aut->prop_deterministic() || aut->prop_unambiguous())
if (aut->prop_unambiguous())
return true;
auto clean_a = scc_filter_states(aut);
if (clean_a->num_edges() == 0)