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.
This commit is contained in:
Alexandre Duret-Lutz 2017-04-27 10:04:51 +02:00
parent 0c69649ba1
commit ca7f72bb4b
5 changed files with 166 additions and 171 deletions

View file

@ -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",

View file

@ -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))