autfilt: fix -u
Fixes #399. * bin/autfilt.cc: Fix it. * tests/core/isomorph.test: Add test case. * NEWS: Mention the issue.
This commit is contained in:
parent
5b8dbc6549
commit
e2ec711c40
3 changed files with 37 additions and 7 deletions
3
NEWS
3
NEWS
|
|
@ -9,6 +9,9 @@ New in spot 2.8.6.dev (not yet released)
|
||||||
incorrectly tagged as complete, causing the print_hoa() function
|
incorrectly tagged as complete, causing the print_hoa() function
|
||||||
to raise an exception.
|
to raise an exception.
|
||||||
|
|
||||||
|
- autfilt --uniq was not considering differences in acceptance
|
||||||
|
conditions or number of states when discarding automata.
|
||||||
|
|
||||||
New in spot 2.8.6 (2020-02-19)
|
New in spot 2.8.6 (2020-02-19)
|
||||||
|
|
||||||
Bugs fixed:
|
Bugs fixed:
|
||||||
|
|
|
||||||
|
|
@ -419,8 +419,31 @@ static const struct argp_child children[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct canon_aut
|
||||||
|
{
|
||||||
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
|
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
|
||||||
typedef std::set<std::vector<tr_t>> unique_aut_t;
|
unsigned num_states;
|
||||||
|
std::vector<tr_t> edges;
|
||||||
|
std::string acc;
|
||||||
|
|
||||||
|
canon_aut(const spot::const_twa_graph_ptr& aut)
|
||||||
|
: num_states(aut->num_states())
|
||||||
|
, edges(aut->edge_vector().begin() + 1,
|
||||||
|
aut->edge_vector().end())
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
aut->get_acceptance().to_text(os);
|
||||||
|
acc = os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const canon_aut& o) const
|
||||||
|
{
|
||||||
|
return std::tie(num_states, edges, acc)
|
||||||
|
< std::tie(o.num_states, o.edges, o.acc);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::set<canon_aut> unique_aut_t;
|
||||||
static long int match_count = 0;
|
static long int match_count = 0;
|
||||||
static spot::option_map extra_options;
|
static spot::option_map extra_options;
|
||||||
static bool randomize_st = false;
|
static bool randomize_st = false;
|
||||||
|
|
@ -703,8 +726,7 @@ parse_opt(int key, char* arg, struct argp_state*)
|
||||||
opt_max_count = to_pos_int(arg, "-n/--max-count");
|
opt_max_count = to_pos_int(arg, "-n/--max-count");
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
opt->uniq =
|
opt->uniq = std::unique_ptr<unique_aut_t>(new std::set<canon_aut>());
|
||||||
std::unique_ptr<unique_aut_t>(new std::set<std::vector<tr_t>>());
|
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
opt_invert = true;
|
opt_invert = true;
|
||||||
|
|
@ -1559,8 +1581,7 @@ namespace
|
||||||
auto tmp =
|
auto tmp =
|
||||||
spot::canonicalize(make_twa_graph(aut,
|
spot::canonicalize(make_twa_graph(aut,
|
||||||
spot::twa::prop_set::all()));
|
spot::twa::prop_set::all()));
|
||||||
if (!opt->uniq->emplace(tmp->edge_vector().begin() + 1,
|
if (!opt->uniq->emplace(tmp).second)
|
||||||
tmp->edge_vector().end()).second)
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement de
|
# Copyright (C) 2014, 2015, 2020 Laboratoire de Recherche et Développement de
|
||||||
# l'Epita (LRDE).
|
# l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -109,3 +109,9 @@ run 0 autfilt aut3 --are-isomorphic aut4
|
||||||
|
|
||||||
run 0 autfilt -u aut1 aut2 aut2 aut3 -c >out
|
run 0 autfilt -u aut1 aut2 aut2 aut3 -c >out
|
||||||
test 2 = "`cat out`"
|
test 2 = "`cat out`"
|
||||||
|
|
||||||
|
ltl2tgba -D -G GFa > aut1
|
||||||
|
ltl2tgba -D -G FGa > aut2
|
||||||
|
test 0 = `autfilt -c --are-isomorphic aut1 aut2`
|
||||||
|
test 2 = `ltl2tgba -D -G 'GFa' 'FG!a' | autfilt -u -c`
|
||||||
|
test 1 = `ltl2tgba -D -G 'GFa' 'GFa' | autfilt -u -c`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue