gen: rename genltl() to ltl_pattern() and introduce ltl_patterns()
* spot/gen/formulas.hh, spot/gen/formulas.cc (genltl): Rename as... (ltl_pattern): This. (ltl_pattern_max): New function. * bin/genltl.cc: Adjust names, and simplify using ltl_pattern_max(). * python/spot/gen.i (ltl_patterns): New function. * tests/python/gen.py: Test it. * tests/python/gen.ipynb: New file to document the spot.gen package. * tests/Makefile.am, doc/org/tut.org: Add gen.ipynb.
This commit is contained in:
parent
2dc115fe2c
commit
540b971355
8 changed files with 640 additions and 55 deletions
|
|
@ -1041,7 +1041,7 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
formula genltl(ltl_pattern pattern, int n)
|
||||
formula ltl_pattern(ltl_pattern_id pattern, int n)
|
||||
{
|
||||
if (n < 0)
|
||||
{
|
||||
|
|
@ -1127,7 +1127,7 @@ namespace spot
|
|||
}
|
||||
|
||||
|
||||
const char* ltl_pattern_name(ltl_pattern pattern)
|
||||
const char* ltl_pattern_name(ltl_pattern_id pattern)
|
||||
{
|
||||
static const char* const class_name[] =
|
||||
{
|
||||
|
|
@ -1174,6 +1174,60 @@ namespace spot
|
|||
return class_name[pattern - FIRST_CLASS];
|
||||
}
|
||||
|
||||
int ltl_pattern_max(ltl_pattern_id pattern)
|
||||
{
|
||||
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:
|
||||
return 0;
|
||||
case DAC_PATTERNS:
|
||||
return 55;
|
||||
case EH_PATTERNS:
|
||||
return 12;
|
||||
case GH_Q:
|
||||
case GH_R:
|
||||
case GO_THETA:
|
||||
return 0;
|
||||
case HKRSS_PATTERNS:
|
||||
return 55;
|
||||
case KR_N:
|
||||
case KR_NLOGN:
|
||||
case KV_PSI:
|
||||
case OR_FG:
|
||||
case OR_G:
|
||||
case OR_GF:
|
||||
return 0;
|
||||
case 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:
|
||||
return 0;
|
||||
case 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:
|
||||
return 0;
|
||||
case LAST_CLASS:
|
||||
break;
|
||||
}
|
||||
throw std::runtime_error("unsupported pattern");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace spot
|
|||
{
|
||||
namespace gen
|
||||
{
|
||||
enum ltl_pattern {
|
||||
enum ltl_pattern_id {
|
||||
FIRST_CLASS = 256,
|
||||
AND_F = FIRST_CLASS,
|
||||
AND_FG,
|
||||
|
|
@ -205,15 +205,21 @@ namespace spot
|
|||
|
||||
/// \brief generate an LTL from a known pattern
|
||||
///
|
||||
/// The pattern is specified using one value from the ltl_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.
|
||||
SPOT_API formula genltl(ltl_pattern pattern, int n);
|
||||
SPOT_API formula ltl_pattern(ltl_pattern_id pattern, int n);
|
||||
|
||||
/// \brief convert an ltl_pattern value into a name
|
||||
///
|
||||
/// The returned name is suitable to be used as an option
|
||||
/// key for the genltl binary.
|
||||
SPOT_API const char* ltl_pattern_name(ltl_pattern pattern);
|
||||
SPOT_API const char* ltl_pattern_name(ltl_pattern_id pattern);
|
||||
|
||||
/// \brief upper bound for LTL patterns
|
||||
///
|
||||
/// If an LTL pattern has an upper bound, this returns it.
|
||||
/// Otherwise, this returns 0.
|
||||
SPOT_API int ltl_pattern_max(ltl_pattern_id pattern);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue