autfilt: %w shows an accepting word
* src/bin/autfilt.cc: Support %w. * src/tgbatest/readsave.test: Test it.
This commit is contained in:
parent
a626a32dbc
commit
b83d6d7f29
2 changed files with 41 additions and 0 deletions
|
|
@ -49,6 +49,9 @@
|
||||||
#include "hoaparse/public.hh"
|
#include "hoaparse/public.hh"
|
||||||
#include "tgbaalgos/sccinfo.hh"
|
#include "tgbaalgos/sccinfo.hh"
|
||||||
#include "tgbaalgos/randomize.hh"
|
#include "tgbaalgos/randomize.hh"
|
||||||
|
#include "tgbaalgos/gtec/gtec.hh"
|
||||||
|
#include "tgbaalgos/reducerun.hh"
|
||||||
|
#include "tgbaalgos/word.hh"
|
||||||
#include "tgbaalgos/are_isomorphic.hh"
|
#include "tgbaalgos/are_isomorphic.hh"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,6 +147,8 @@ static const argp_option options[] =
|
||||||
"1 if the output is complete, 0 otherwise", 0 },
|
"1 if the output is complete, 0 otherwise", 0 },
|
||||||
{ "%r", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
|
{ "%r", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
|
||||||
"processing time (excluding parsing) in seconds", 0 },
|
"processing time (excluding parsing) in seconds", 0 },
|
||||||
|
{ "%w", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
|
||||||
|
"one word accepted by the output automaton", 0 },
|
||||||
{ "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
|
{ "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
|
||||||
"a single %", 0 },
|
"a single %", 0 },
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
|
@ -427,6 +432,7 @@ namespace
|
||||||
declare('m', &aut_name_);
|
declare('m', &aut_name_);
|
||||||
declare('S', &haut_states_);
|
declare('S', &haut_states_);
|
||||||
declare('T', &haut_trans_);
|
declare('T', &haut_trans_);
|
||||||
|
declare('w', &aut_word_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief print the configured statistics.
|
/// \brief print the configured statistics.
|
||||||
|
|
@ -481,6 +487,26 @@ namespace
|
||||||
if (has('C'))
|
if (has('C'))
|
||||||
haut_scc_ = spot::scc_info(haut->aut).scc_count();
|
haut_scc_ = spot::scc_info(haut->aut).scc_count();
|
||||||
|
|
||||||
|
if (has('w'))
|
||||||
|
{
|
||||||
|
auto res = spot::couvreur99(aut)->check();
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
auto run = res->accepting_run();
|
||||||
|
assert(run);
|
||||||
|
run = reduce_run(aut, run);
|
||||||
|
spot::tgba_word w(run);
|
||||||
|
w.simplify();
|
||||||
|
std::ostringstream out;
|
||||||
|
w.print(out, aut->get_dict());
|
||||||
|
aut_word_ = out.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aut_word_.val().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this->spot::stat_printer::print(aut, 0, run_time);
|
return this->spot::stat_printer::print(aut, 0, run_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -488,6 +514,7 @@ namespace
|
||||||
spot::printable_value<const char*> filename_;
|
spot::printable_value<const char*> filename_;
|
||||||
spot::printable_value<std::string> haut_name_;
|
spot::printable_value<std::string> haut_name_;
|
||||||
spot::printable_value<std::string> aut_name_;
|
spot::printable_value<std::string> aut_name_;
|
||||||
|
spot::printable_value<std::string> aut_word_;
|
||||||
spot::printable_value<unsigned> haut_states_;
|
spot::printable_value<unsigned> haut_states_;
|
||||||
spot::printable_value<unsigned> haut_edges_;
|
spot::printable_value<unsigned> haut_edges_;
|
||||||
spot::printable_value<unsigned> haut_trans_;
|
spot::printable_value<unsigned> haut_trans_;
|
||||||
|
|
|
||||||
|
|
@ -270,3 +270,17 @@ EOF
|
||||||
|
|
||||||
$autfilt --merge -Hm input --name="%E->%e edges, %T->%t transitions" > output
|
$autfilt --merge -Hm input --name="%E->%e edges, %T->%t transitions" > output
|
||||||
diff output expected
|
diff output expected
|
||||||
|
|
||||||
|
|
||||||
|
cat <<EOF | $ltl2tgba -x degen-skip=1 -F- --ba -H > tmp.hoa
|
||||||
|
a U b
|
||||||
|
false
|
||||||
|
!b && Xb && GFa
|
||||||
|
EOF
|
||||||
|
$autfilt <tmp.hoa --stats='"%M","%w"' > output
|
||||||
|
cat >expected <<EOF
|
||||||
|
"a U b","cycle{b}"
|
||||||
|
"0",""
|
||||||
|
"!b & X(b & GFa)","!b; cycle{a & b}"
|
||||||
|
EOF
|
||||||
|
diff output expected
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue