From ca7f72bb4b0ae837983b6d08043759e9b94e27e9 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 27 Apr 2017 10:04:51 +0200 Subject: [PATCH] gen: prefix ltl_pattern identifiers with LTL_ This helps with autocompletion in IPython, and it will prevent us from mixing LTL patterns with automata patterns (once we have more than one automata generator). * spot/gen/formulas.hh: Here. * spot/gen/formulas.cc, bin/genltl.cc, tests/python/gen.ipynb, tests/python/gen.py: Adjust. --- bin/genltl.cc | 101 ++++++++++++++--------------- spot/gen/formulas.cc | 142 ++++++++++++++++++++--------------------- spot/gen/formulas.hh | 74 ++++++++++----------- tests/python/gen.ipynb | 8 +-- tests/python/gen.py | 12 ++-- 5 files changed, 166 insertions(+), 171 deletions(-) diff --git a/bin/genltl.cc b/bin/genltl.cc index 51a01cc7b..2e4e32b6d 100644 --- a/bin/genltl.cc +++ b/bin/genltl.cc @@ -48,11 +48,10 @@ using namespace spot; const char argp_program_doc[] ="\ Generate temporal logic formulas from predefined patterns."; -// We reuse the values from spot::gen::ltl_pattern_id as option keys. -// Additional options should therefore start after -// spot::gen::LAST_CLASS. +// We reuse the values from gen::ltl_pattern_id as option keys. +// Additional options should therefore start after gen::LTL_END. enum { - OPT_POSITIVE = spot::gen::LAST_CLASS + 1, + OPT_POSITIVE = gen::LTL_END, OPT_NEGATIVE, }; @@ -66,83 +65,79 @@ static const argp_option options[] = { nullptr, 0, nullptr, 0, "Pattern selection:", 1}, // J. Geldenhuys and H. Hansen (Spin'06): Larger automata and less // work for LTL model checking. - { "and-f", spot::gen::AND_F, "RANGE", 0, "F(p1)&F(p2)&...&F(pn)", 0 }, + { "and-f", gen::LTL_AND_F, "RANGE", 0, "F(p1)&F(p2)&...&F(pn)", 0 }, OPT_ALIAS(gh-e), - { "and-fg", spot::gen::AND_FG, "RANGE", 0, "FG(p1)&FG(p2)&...&FG(pn)", 0 }, - { "and-gf", spot::gen::AND_GF, "RANGE", 0, "GF(p1)&GF(p2)&...&GF(pn)", 0 }, + { "and-fg", gen::LTL_AND_FG, "RANGE", 0, "FG(p1)&FG(p2)&...&FG(pn)", 0 }, + { "and-gf", gen::LTL_AND_GF, "RANGE", 0, "GF(p1)&GF(p2)&...&GF(pn)", 0 }, OPT_ALIAS(ccj-phi), OPT_ALIAS(gh-c2), - { "ccj-alpha", spot::gen::CCJ_ALPHA, "RANGE", 0, + { "ccj-alpha", gen::LTL_CCJ_ALPHA, "RANGE", 0, "F(p1&F(p2&F(p3&...F(pn)))) & F(q1&F(q2&F(q3&...F(qn))))", 0 }, - { "ccj-beta", spot::gen::CCJ_BETA, "RANGE", 0, + { "ccj-beta", gen::LTL_CCJ_BETA, "RANGE", 0, "F(p&X(p&X(p&...X(p)))) & F(q&X(q&X(q&...X(q))))", 0 }, - { "ccj-beta-prime", spot::gen::CCJ_BETA_PRIME, "RANGE", 0, + { "ccj-beta-prime", gen::LTL_CCJ_BETA_PRIME, "RANGE", 0, "F(p&(Xp)&(XXp)&...(X...X(p))) & F(q&(Xq)&(XXq)&...(X...X(q)))", 0 }, - { "dac-patterns", spot::gen::DAC_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, + { "dac-patterns", gen::LTL_DAC_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, "Dwyer et al. [FMSP'98] Spec. Patterns for LTL " "(range should be included in 1..55)", 0 }, OPT_ALIAS(spec-patterns), - { "eh-patterns", spot::gen::EH_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, + { "eh-patterns", gen::LTL_EH_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, "Etessami and Holzmann [Concur'00] patterns " "(range should be included in 1..12)", 0 }, - { "gh-q", spot::gen::GH_Q, "RANGE", 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", spot::gen::GH_R, "RANGE", 0, + { "gh-r", gen::LTL_GH_R, "RANGE", 0, "(GF(p1)|FG(p2))&(GF(p2)|FG(p3))&... &(GF(pn)|FG(p{n+1}))", 0 }, - { "go-theta", spot::gen::GO_THETA, "RANGE", 0, + { "go-theta", gen::LTL_GO_THETA, "RANGE", 0, "!((GF(p1)&GF(p2)&...&GF(pn)) -> G(q->F(r)))", 0 }, - { "hkrss-patterns", spot::gen::HKRSS_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, + { "hkrss-patterns", gen::LTL_HKRSS_PATTERNS, + "RANGE", OPTION_ARG_OPTIONAL, "Holeček et al. patterns from the Liberouter project " "(range should be included in 1..55)", 0 }, OPT_ALIAS(liberouter-patterns), - { "kr-n", spot::gen::KR_N, "RANGE", 0, + { "kr-n", gen::LTL_KR_N, "RANGE", 0, "linear formula with doubly exponential DBA", 0 }, - { "kr-nlogn", spot::gen::KR_NLOGN, "RANGE", 0, + { "kr-nlogn", gen::LTL_KR_NLOGN, "RANGE", 0, "quasilinear formula with doubly exponential DBA", 0 }, - { "kv-psi", spot::gen::KV_PSI, "RANGE", 0, + { "kv-psi", gen::LTL_KV_PSI, "RANGE", 0, "quadratic formula with doubly exponential DBA", 0 }, OPT_ALIAS(kr-n2), - { "or-fg", spot::gen::OR_FG, "RANGE", 0, "FG(p1)|FG(p2)|...|FG(pn)", 0 }, + { "or-fg", gen::LTL_OR_FG, "RANGE", 0, "FG(p1)|FG(p2)|...|FG(pn)", 0 }, OPT_ALIAS(ccj-xi), - { "or-g", spot::gen::OR_G, "RANGE", 0, "G(p1)|G(p2)|...|G(pn)", 0 }, + { "or-g", gen::LTL_OR_G, "RANGE", 0, "G(p1)|G(p2)|...|G(pn)", 0 }, OPT_ALIAS(gh-s), - { "or-gf", spot::gen::OR_GF, "RANGE", 0, "GF(p1)|GF(p2)|...|GF(pn)", 0 }, + { "or-gf", gen::LTL_OR_GF, "RANGE", 0, "GF(p1)|GF(p2)|...|GF(pn)", 0 }, OPT_ALIAS(gh-c1), - { "p-patterns", spot::gen::P_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, + { "p-patterns", gen::LTL_P_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, "Pelánek [Spin'07] patterns from BEEM " "(range should be included in 1..20)", 0 }, OPT_ALIAS(beem-patterns), OPT_ALIAS(p), - { "r-left", spot::gen::R_LEFT, "RANGE", 0, - "(((p1 R p2) R p3) ... R pn)", 0 }, - { "r-right", spot::gen::R_RIGHT, "RANGE", 0, - "(p1 R (p2 R (... R pn)))", 0 }, - { "rv-counter", spot::gen::RV_COUNTER, "RANGE", 0, - "n-bit counter", 0 }, - { "rv-counter-carry", spot::gen::RV_COUNTER_CARRY, "RANGE", 0, + { "r-left", gen::LTL_R_LEFT, "RANGE", 0, "(((p1 R p2) R p3) ... R pn)", 0 }, + { "r-right", gen::LTL_R_RIGHT, "RANGE", 0, "(p1 R (p2 R (... R pn)))", 0 }, + { "rv-counter", gen::LTL_RV_COUNTER, "RANGE", 0, "n-bit counter", 0 }, + { "rv-counter-carry", gen::LTL_RV_COUNTER_CARRY, "RANGE", 0, "n-bit counter w/ carry", 0 }, - { "rv-counter-carry-linear", spot::gen::RV_COUNTER_CARRY_LINEAR, "RANGE", 0, - "n-bit counter w/ carry (linear size)", 0 }, - { "rv-counter-linear", spot::gen::RV_COUNTER_LINEAR, "RANGE", 0, + { "rv-counter-carry-linear", gen::LTL_RV_COUNTER_CARRY_LINEAR, + "RANGE", 0, "n-bit counter w/ carry (linear size)", 0 }, + { "rv-counter-linear", gen::LTL_RV_COUNTER_LINEAR, "RANGE", 0, "n-bit counter (linear size)", 0 }, - { "sb-patterns", spot::gen::SB_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, + { "sb-patterns", gen::LTL_SB_PATTERNS, "RANGE", OPTION_ARG_OPTIONAL, "Somenzi and Bloem [CAV'00] patterns " "(range should be included in 1..27)", 0 }, - { "tv-f1", spot::gen::TV_F1, "RANGE", 0, + { "tv-f1", gen::LTL_TV_F1, "RANGE", 0, "G(p -> (q | Xq | ... | XX...Xq)", 0 }, - { "tv-f2", spot::gen::TV_F2, "RANGE", 0, + { "tv-f2", gen::LTL_TV_F2, "RANGE", 0, "G(p -> (q | X(q | X(... | Xq)))", 0 }, - { "tv-g1", spot::gen::TV_G1, "RANGE", 0, + { "tv-g1", gen::LTL_TV_G1, "RANGE", 0, "G(p -> (q & Xq & ... & XX...Xq)", 0 }, - { "tv-g2", spot::gen::TV_G2, "RANGE", 0, + { "tv-g2", gen::LTL_TV_G2, "RANGE", 0, "G(p -> (q & X(q & X(... & Xq)))", 0 }, - { "tv-uu", spot::gen::TV_UU, "RANGE", 0, + { "tv-uu", gen::LTL_TV_UU, "RANGE", 0, "G(p1 -> (p1 U (p2 & (p2 U (p3 & (p3 U ...))))))", 0 }, - { "u-left", spot::gen::U_LEFT, "RANGE", 0, - "(((p1 U p2) U p3) ... U pn)", 0 }, + { "u-left", gen::LTL_U_LEFT, "RANGE", 0, "(((p1 U p2) U p3) ... U pn)", 0 }, OPT_ALIAS(gh-u), - { "u-right", spot::gen::U_RIGHT, "RANGE", 0, - "(p1 U (p2 U (... U pn)))", 0 }, + { "u-right", gen::LTL_U_RIGHT, "RANGE", 0, "(p1 U (p2 U (... U pn)))", 0 }, OPT_ALIAS(gh-u2), OPT_ALIAS(go-phi), RANGE_DOC, @@ -171,7 +166,7 @@ static const argp_option options[] = struct job { - spot::gen::ltl_pattern_id pattern; + gen::ltl_pattern_id pattern; struct range range; }; @@ -191,7 +186,7 @@ static void enqueue_job(int pattern, const char* range_str = nullptr) { job j; - j.pattern = static_cast(pattern); + j.pattern = static_cast(pattern); if (range_str) { j.range = parse_range(range_str); @@ -199,10 +194,10 @@ enqueue_job(int pattern, const char* range_str = nullptr) else { j.range.min = 1; - j.range.max = spot::gen::ltl_pattern_max(j.pattern); + j.range.max = gen::ltl_pattern_max(j.pattern); if (j.range.max == 0) error(2, 0, "missing range for %s", - spot::gen::ltl_pattern_name(j.pattern)); + gen::ltl_pattern_name(j.pattern)); } jobs.push_back(j); } @@ -210,7 +205,7 @@ enqueue_job(int pattern, const char* range_str = nullptr) static int parse_opt(int key, char* arg, struct argp_state*) { - if (key >= spot::gen::FIRST_CLASS && key < spot::gen::LAST_CLASS) + if (key >= gen::LTL_BEGIN && key < gen::LTL_END) { enqueue_job(key, arg); return 0; @@ -232,9 +227,9 @@ parse_opt(int key, char* arg, struct argp_state*) static void -output_pattern(spot::gen::ltl_pattern_id pattern, int n) +output_pattern(gen::ltl_pattern_id pattern, int n) { - formula f = spot::gen::ltl_pattern(pattern, n); + formula f = gen::ltl_pattern(pattern, n); // Make sure we use only "p42"-style of atomic propositions // in lbt's output. @@ -243,13 +238,13 @@ output_pattern(spot::gen::ltl_pattern_id pattern, int n) if (opt_positive || !opt_negative) { - output_formula_checked(f, spot::gen::ltl_pattern_name(pattern), n); + output_formula_checked(f, gen::ltl_pattern_name(pattern), n); } if (opt_negative) { std::string tmp = "!"; - tmp += spot::gen::ltl_pattern_name(pattern); - output_formula_checked(spot::formula::Not(f), tmp.c_str(), n); + tmp += gen::ltl_pattern_name(pattern); + output_formula_checked(formula::Not(f), tmp.c_str(), n); } } diff --git a/spot/gen/formulas.cc b/spot/gen/formulas.cc index c07128735..f36414a2b 100644 --- a/spot/gen/formulas.cc +++ b/spot/gen/formulas.cc @@ -1054,73 +1054,73 @@ namespace spot switch (pattern) { // Keep this alphabetically-ordered! - case AND_F: + case LTL_AND_F: return combunop_n("p", n, op::F, true); - case AND_FG: + case LTL_AND_FG: return FG_n("p", n, true); - case AND_GF: + case LTL_AND_GF: return GF_n("p", n, true); - case CCJ_ALPHA: + case LTL_CCJ_ALPHA: return formula::And({E_n("p", n), E_n("q", n)}); - case CCJ_BETA: + case LTL_CCJ_BETA: return formula::And({N_n("p", n), N_n("q", n)}); - case CCJ_BETA_PRIME: + case LTL_CCJ_BETA_PRIME: return formula::And({N_prime_n("p", n), N_prime_n("q", n)}); - case DAC_PATTERNS: + case LTL_DAC_PATTERNS: return dac_pattern(n); - case EH_PATTERNS: + case LTL_EH_PATTERNS: return eh_pattern(n); - case GH_Q: + case LTL_GH_Q: return Q_n("p", n); - case GH_R: + case LTL_GH_R: return R_n("p", n); - case GO_THETA: + case LTL_GO_THETA: return fair_response("p", "q", "r", n); - case HKRSS_PATTERNS: + case LTL_HKRSS_PATTERNS: return hkrss_pattern(n); - case KR_N: + case LTL_KR_N: return kr2_exp(n, "a", "b", "c", "d"); - case KR_NLOGN: + case LTL_KR_NLOGN: return kr1_exp(n, "a", "b", "c", "d", "y", "z"); - case KV_PSI: + case LTL_KV_PSI: return kv_exp(n, "a", "b", "c", "d"); - case OR_FG: + case LTL_OR_FG: return FG_n("p", n, false); - case OR_G: + case LTL_OR_G: return combunop_n("p", n, op::G, false); - case OR_GF: + case LTL_OR_GF: return GF_n("p", n, false); - case P_PATTERNS: + case LTL_P_PATTERNS: return p_pattern(n); - case R_LEFT: + case LTL_R_LEFT: return bin_n("p", n, op::R, false); - case R_RIGHT: + case LTL_R_RIGHT: return bin_n("p", n, op::R, true); - case RV_COUNTER_CARRY: + case LTL_RV_COUNTER_CARRY: return ltl_counter_carry("b", "m", "c", n, false); - case RV_COUNTER_CARRY_LINEAR: + case LTL_RV_COUNTER_CARRY_LINEAR: return ltl_counter_carry("b", "m", "c", n, true); - case RV_COUNTER: + case LTL_RV_COUNTER: return ltl_counter("b", "m", n, false); - case RV_COUNTER_LINEAR: + case LTL_RV_COUNTER_LINEAR: return ltl_counter("b", "m", n, true); - case SB_PATTERNS: + case LTL_SB_PATTERNS: return sb_pattern(n); - case TV_F1: + case LTL_TV_F1: return tv_f1("p", "q", n); - case TV_F2: + case LTL_TV_F2: return tv_f2("p", "q", n); - case TV_G1: + case LTL_TV_G1: return tv_g1("p", "q", n); - case TV_G2: + case LTL_TV_G2: return tv_g2("p", "q", n); - case TV_UU: + case LTL_TV_UU: return tv_uu("p", n); - case U_LEFT: + case LTL_U_LEFT: return bin_n("p", n, op::U, false); - case U_RIGHT: + case LTL_U_RIGHT: return bin_n("p", n, op::U, true); - case LAST_CLASS: + case LTL_END: break; } throw std::runtime_error("unsupported pattern"); @@ -1168,10 +1168,10 @@ namespace spot // Make sure we do not forget to update the above table every // time a new pattern is added. static_assert(sizeof(class_name)/sizeof(*class_name) - == LAST_CLASS - FIRST_CLASS, "size mismatch"); - if (pattern < FIRST_CLASS || pattern >= LAST_CLASS) + == LTL_END - LTL_BEGIN, "size mismatch"); + if (pattern < LTL_BEGIN || pattern >= LTL_END) throw std::runtime_error("unsupported pattern"); - return class_name[pattern - FIRST_CLASS]; + return class_name[pattern - LTL_BEGIN]; } int ltl_pattern_max(ltl_pattern_id pattern) @@ -1179,50 +1179,50 @@ namespace spot switch (pattern) { // Keep this alphabetically-ordered! - case AND_F: - case AND_FG: - case AND_GF: - case CCJ_ALPHA: - case CCJ_BETA: - case CCJ_BETA_PRIME: + case LTL_AND_F: + case LTL_AND_FG: + case LTL_AND_GF: + case LTL_CCJ_ALPHA: + case LTL_CCJ_BETA: + case LTL_CCJ_BETA_PRIME: return 0; - case DAC_PATTERNS: + case LTL_DAC_PATTERNS: return 55; - case EH_PATTERNS: + case LTL_EH_PATTERNS: return 12; - case GH_Q: - case GH_R: - case GO_THETA: + case LTL_GH_Q: + case LTL_GH_R: + case LTL_GO_THETA: return 0; - case HKRSS_PATTERNS: + case LTL_HKRSS_PATTERNS: return 55; - case KR_N: - case KR_NLOGN: - case KV_PSI: - case OR_FG: - case OR_G: - case OR_GF: + case LTL_KR_N: + case LTL_KR_NLOGN: + case LTL_KV_PSI: + case LTL_OR_FG: + case LTL_OR_G: + case LTL_OR_GF: return 0; - case P_PATTERNS: + case LTL_P_PATTERNS: return 20; - case R_LEFT: - case R_RIGHT: - case RV_COUNTER_CARRY: - case RV_COUNTER_CARRY_LINEAR: - case RV_COUNTER: - case RV_COUNTER_LINEAR: + case LTL_R_LEFT: + case LTL_R_RIGHT: + case LTL_RV_COUNTER_CARRY: + case LTL_RV_COUNTER_CARRY_LINEAR: + case LTL_RV_COUNTER: + case LTL_RV_COUNTER_LINEAR: return 0; - case SB_PATTERNS: + case LTL_SB_PATTERNS: return 27; - case TV_F1: - case TV_F2: - case TV_G1: - case TV_G2: - case TV_UU: - case U_LEFT: - case U_RIGHT: + case LTL_TV_F1: + case LTL_TV_F2: + case LTL_TV_G1: + case LTL_TV_G2: + case LTL_TV_UU: + case LTL_U_LEFT: + case LTL_U_RIGHT: return 0; - case LAST_CLASS: + case LTL_END: break; } throw std::runtime_error("unsupported pattern"); diff --git a/spot/gen/formulas.hh b/spot/gen/formulas.hh index 102c0a428..8da91963c 100644 --- a/spot/gen/formulas.hh +++ b/spot/gen/formulas.hh @@ -166,51 +166,51 @@ namespace spot namespace gen { enum ltl_pattern_id { - FIRST_CLASS = 256, - AND_F = FIRST_CLASS, - AND_FG, - AND_GF, - CCJ_ALPHA, - CCJ_BETA, - CCJ_BETA_PRIME, - DAC_PATTERNS, - EH_PATTERNS, - GH_Q, - GH_R, - GO_THETA, - HKRSS_PATTERNS, - KR_N, - KR_NLOGN, - KV_PSI, - OR_FG, - OR_G, - OR_GF, - P_PATTERNS, - R_LEFT, - R_RIGHT, - RV_COUNTER, - RV_COUNTER_CARRY, - RV_COUNTER_CARRY_LINEAR, - RV_COUNTER_LINEAR, - SB_PATTERNS, - TV_F1, - TV_F2, - TV_G1, - TV_G2, - TV_UU, - U_LEFT, - U_RIGHT, - LAST_CLASS, + LTL_BEGIN = 256, + LTL_AND_F = LTL_BEGIN, + LTL_AND_FG, + LTL_AND_GF, + LTL_CCJ_ALPHA, + LTL_CCJ_BETA, + LTL_CCJ_BETA_PRIME, + LTL_DAC_PATTERNS, + LTL_EH_PATTERNS, + LTL_GH_Q, + LTL_GH_R, + LTL_GO_THETA, + LTL_HKRSS_PATTERNS, + LTL_KR_N, + LTL_KR_NLOGN, + LTL_KV_PSI, + LTL_OR_FG, + LTL_OR_G, + LTL_OR_GF, + LTL_P_PATTERNS, + LTL_R_LEFT, + LTL_R_RIGHT, + LTL_RV_COUNTER, + LTL_RV_COUNTER_CARRY, + LTL_RV_COUNTER_CARRY_LINEAR, + LTL_RV_COUNTER_LINEAR, + LTL_SB_PATTERNS, + LTL_TV_F1, + LTL_TV_F2, + LTL_TV_G1, + LTL_TV_G2, + LTL_TV_UU, + LTL_U_LEFT, + LTL_U_RIGHT, + LTL_END }; /// \brief generate an LTL from a known pattern /// /// The pattern is specified using one value from the ltl_pattern_id /// enum. See the man page of the `genltl` binary for a - /// description of those pattern, and bibliographic references. + /// description of those patterns, and bibliographic references. SPOT_API formula ltl_pattern(ltl_pattern_id pattern, int n); - /// \brief convert an ltl_pattern value into a name + /// \brief convert an ltl_pattern_id value into a name /// /// The returned name is suitable to be used as an option /// key for the genltl binary. diff --git a/tests/python/gen.ipynb b/tests/python/gen.ipynb index 7160d7bd1..04d69503a 100644 --- a/tests/python/gen.ipynb +++ b/tests/python/gen.ipynb @@ -60,7 +60,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "sg.ltl_pattern(sg.AND_GF, 3)" + "sg.ltl_pattern(sg.LTL_AND_GF, 3)" ], "language": "python", "metadata": {}, @@ -83,7 +83,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "sg.ltl_pattern(sg.CCJ_BETA_PRIME, 4)" + "sg.ltl_pattern(sg.LTL_CCJ_BETA_PRIME, 4)" ], "language": "python", "metadata": {}, @@ -106,7 +106,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To see the list of supported patterns, the easiest way is to look at the `--help` output of `genltl`. The above pattern for instance is attached to option `--ccj-beta-prime`. The name of the pattern identifier is the same using capital letters and underscores. If a pattern has multiple aliased options in `genltl`, the first one used for the identifier (e.g., `genltl` accept both `--dac-patterns` and `--spec-patterns` as synonyms to denote the patterns of `spot.gen.DAC_PATTERNS`).\n", + "To see the list of supported patterns, the easiest way is to look at the `--help` output of `genltl`. The above pattern for instance is attached to option `--ccj-beta-prime`. The name of the pattern identifier is the same using capital letters, underscores, and an `LTL_` prefix. If a pattern has multiple aliased options in `genltl`, the first one used for the identifier (e.g., `genltl` accept both `--dac-patterns` and `--spec-patterns` as synonyms to denote the patterns of `spot.gen.LTL_DAC_PATTERNS`).\n", "\n", "Multiple patterns can be generated using the `ltl_patterns()` function. It's arguments should be either can be:\n", " - pairs of the form `(id, n)`: in this case the pattern `id` with size/index `n` is returned,\n", @@ -120,7 +120,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "for f in sg.ltl_patterns((sg.GH_R, 3), (sg.AND_FG, 1, 3), sg.EH_PATTERNS):\n", + "for f in sg.ltl_patterns((sg.LTL_GH_R, 3), (sg.LTL_AND_FG, 1, 3), sg.LTL_EH_PATTERNS):\n", " display(f)" ], "language": "python", diff --git a/tests/python/gen.py b/tests/python/gen.py index ff3514195..92e1bc9b0 100644 --- a/tests/python/gen.py +++ b/tests/python/gen.py @@ -38,9 +38,9 @@ except RuntimeError as e: else: exit(2) -f = gen.ltl_pattern(gen.AND_F, 3) +f = gen.ltl_pattern(gen.LTL_AND_F, 3) assert f.size() == 3 -assert gen.ltl_pattern_name(gen.AND_F) == "and-f" +assert gen.ltl_pattern_name(gen.LTL_AND_F) == "and-f" try: gen.ltl_pattern(1000, 3) @@ -50,13 +50,13 @@ else: exit(2) try: - gen.ltl_pattern(gen.OR_G, -10) + gen.ltl_pattern(gen.LTL_OR_G, -10) except RuntimeError as e: assert 'or-g' in str(e) assert 'positive' in str(e) else: exit(2) -assert 40 == sum(p.size() for p in gen.ltl_patterns((gen.OR_G, 1, 5), - (gen.GH_Q, 3), - gen.EH_PATTERNS)) +assert 40 == sum(p.size() for p in gen.ltl_patterns((gen.LTL_OR_G, 1, 5), + (gen.LTL_GH_Q, 3), + gen.LTL_EH_PATTERNS))