Commit 6a11e149 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

autfilt: add --is-very-weak

* bin/autfilt.cc: Implement --is-very-weak.
* tests/core/strength.test: Test it.
* NEWS: Mention it.
parent 12f6c8cf
......@@ -11,6 +11,8 @@ New in spot 2.2.2.dev (Not yet released)
alternating automata, but in any case they should display a
diagnostic: if you see a crash, please report it.
* autfilt has a new --is-very-weak filter.
Library:
* A twa is required to have at least one state, the initial state.
......
......@@ -110,6 +110,7 @@ enum {
OPT_IS_UNAMBIGUOUS,
OPT_IS_WEAK,
OPT_IS_INHERENTLY_WEAK,
OPT_IS_VERY_WEAK,
OPT_KEEP_STATES,
OPT_MASK_ACC,
OPT_MERGE,
......@@ -179,6 +180,8 @@ static const argp_option options[] =
"keep only weak automata", 0 },
{ "is-inherently-weak", OPT_IS_INHERENTLY_WEAK, nullptr, 0,
"keep only inherently weak automata", 0 },
{ "is-very-weak", OPT_IS_VERY_WEAK, nullptr, 0,
"keep only very-weak automata", 0 },
{ "intersect", OPT_INTERSECT, "FILENAME", 0,
"keep automata whose languages have an non-empty intersection with"
" the automaton from FILENAME", 0 },
......@@ -412,6 +415,7 @@ static bool opt_is_unambiguous = false;
static bool opt_is_terminal = false;
static bool opt_is_weak = false;
static bool opt_is_inherently_weak = false;
static bool opt_is_very_weak = false;
static bool opt_is_stutter_invariant = false;
static bool opt_invert = false;
static range opt_states = { 0, std::numeric_limits<int>::max() };
......@@ -658,6 +662,9 @@ parse_opt(int key, char* arg, struct argp_state*)
case OPT_IS_INHERENTLY_WEAK:
opt_is_inherently_weak = true;
break;
case OPT_IS_VERY_WEAK:
opt_is_very_weak = true;
break;
case OPT_IS_STUTTER_INVARIANT:
opt_is_stutter_invariant = true;
break;
......@@ -1061,6 +1068,8 @@ namespace
matched &= is_unambiguous(aut);
if (opt_is_terminal)
matched &= is_terminal_automaton(aut);
else if (opt_is_very_weak)
matched &= is_very_weak_automaton(aut);
else if (opt_is_weak)
matched &= is_weak_automaton(aut);
else if (opt_is_inherently_weak)
......
......@@ -590,6 +590,41 @@ EOF
diff out expected
autfilt -q expected
autfilt --is-very-weak in >out
cat >expected <<EOF
HOA: v1
name: "a U b"
States: 2
Start: 1
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
properties: very-weak
--BODY--
State: 0 {0}
[t] 0
State: 1
[1] 0
[0&!1] 1
--END--
HOA: v1
States: 2
Start: 1
AP: 1 "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc colored
properties: deterministic very-weak
--BODY--
State: 0 {0}
[t] 1
State: 1 {0}
[!0] 1
--END--
EOF
diff out expected
cat >input <<EOF
/* This Büchi automaton is not terminal, because of the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment