diff --git a/NEWS b/NEWS index 964d08c64..a0cef234b 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ New in spot 2.4.0.dev (not yet released) Tools: + - genltl learned to generate a new family of formulas, taken from + the SYNTCOMP competition on reactive synthesis: + --gf-equiv=RANGE (GFa{1} & GFa{2} & ... & GFa{n}) <-> GFz + - genltl learned to generate 4 new families of formulas, taken from Müller & Sickert's GandALF'17 paper: --ms-example=RANGE GF(a1&X(a2&X(a3&...)))&F(b1&F(b2&F(b3&...))) diff --git a/bin/genltl.cc b/bin/genltl.cc index e4722f89a..a93572727 100644 --- a/bin/genltl.cc +++ b/bin/genltl.cc @@ -61,7 +61,7 @@ enum { static const argp_option options[] = { /**************************************************/ - // Keep this alphabetically sorted (expect for aliases). + // Keep this alphabetically sorted (except for aliases). { nullptr, 0, nullptr, 0, "Pattern selection:", 1}, // J. Geldenhuys and H. Hansen (Spin'06): Larger automata and less // work for LTL model checking. @@ -86,6 +86,8 @@ static const argp_option options[] = "(range should be included in 1..12)", 0 }, { "fxg-or", gen::LTL_FXG_OR, "RANGE", 0, "F(p0 | XG(p1 | XG(p2 | ... XG(pn))))", 0}, + { "gf-equiv", gen::LTL_GF_EQUIV, "RANGE", 0, + "(GFa1 & GFa2 & ... & GFan) <-> GFz", 0}, { "gh-q", gen::LTL_GH_Q, "RANGE", 0, "(F(p1)|G(p2))&(F(p2)|G(p3))&...&(F(pn)|G(p{n+1}))", 0 }, { "gh-r", gen::LTL_GH_R, "RANGE", 0, diff --git a/spot/gen/formulas.cc b/spot/gen/formulas.cc index 239e66d29..bed76a207 100644 --- a/spot/gen/formulas.cc +++ b/spot/gen/formulas.cc @@ -41,6 +41,18 @@ namespace spot { namespace { + static formula + LTL_GF_equiv(int n, const std::string& a, const std::string& z) + { + std::vector gfs; + for (int i = 0; i < n; ++i) + gfs.emplace_back(formula::G(formula::F( + formula::ap(a + std::to_string(i+1))))); + + return formula::Equiv(formula::And(gfs), + formula::G(formula::F(formula::ap(z)))); + } + static formula ms_example(const char* a, const char* b, int n) { @@ -1159,6 +1171,8 @@ namespace spot return eh_pattern(n); case LTL_FXG_OR: return FXG_or_n("p", n); + case LTL_GF_EQUIV: + return LTL_GF_equiv(n, "a", "z"); case LTL_GH_Q: return Q_n("p", n); case LTL_GH_R: @@ -1239,6 +1253,7 @@ namespace spot "dac-patterns", "eh-patterns", "fxg-or", + "gf-equiv", "gh-q", "gh-r", "go-theta", @@ -1296,6 +1311,7 @@ namespace spot case LTL_EH_PATTERNS: return 12; case LTL_FXG_OR: + case LTL_GF_EQUIV: case LTL_GH_Q: case LTL_GH_R: case LTL_GO_THETA: diff --git a/spot/gen/formulas.hh b/spot/gen/formulas.hh index 37efa28ff..7ab7f9621 100644 --- a/spot/gen/formulas.hh +++ b/spot/gen/formulas.hh @@ -190,6 +190,7 @@ namespace spot LTL_DAC_PATTERNS, LTL_EH_PATTERNS, LTL_FXG_OR, + LTL_GF_EQUIV, LTL_GH_Q, LTL_GH_R, LTL_GO_THETA, diff --git a/tests/core/genltl.test b/tests/core/genltl.test index 711e739ec..f49045af1 100755 --- a/tests/core/genltl.test +++ b/tests/core/genltl.test @@ -157,3 +157,15 @@ ms-phi-h=3,170 ms-phi-h=4,1816 EOF diff out exp + +genltl --gf-equiv=0..5 --format=%F=%L,%f | + ltl2tgba -G -D -F-/2 --stats='%<,%s' > out +cat >exp<