Track finite formulae.
I.e., SERE without star, or LTL formula using only X and Boolean operators. * src/ltlast/formula.hh, src/ltlast/formula.cc: Add a bit for tracking finite formulas. * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc, src/ltlast/formula.cc: Adjust. * src/ltlast/unop.cc, src/ltlast/binop.cc: Adjust and use that bit to refine the computation of some LTL classes. * src/ltltest/kind.test: New tests.
This commit is contained in:
parent
df760a4597
commit
fb386209aa
9 changed files with 84 additions and 31 deletions
|
|
@ -43,6 +43,7 @@ namespace spot
|
|||
is.eltl_formula = true;
|
||||
is.psl_formula = true;
|
||||
is.sere_formula = true;
|
||||
is.finite = true;
|
||||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.syntactic_safety = true;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace spot
|
|||
is.eltl_formula = true;
|
||||
is.psl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.syntactic_safety = false;
|
||||
|
|
|
|||
|
|
@ -64,16 +64,17 @@ namespace spot
|
|||
// Only formula that are in the intersection of
|
||||
// guarantee and safety are closed by Xor and <=>.
|
||||
bool sg = is.syntactic_safety && is.syntactic_guarantee;
|
||||
bool rp = is.syntactic_recurrence && is.syntactic_persistence;
|
||||
is.syntactic_safety = sg;
|
||||
is.syntactic_guarantee = sg;
|
||||
is.syntactic_recurrence = rp;
|
||||
is.syntactic_persistence = rp;
|
||||
assert(is.syntactic_recurrence == true);
|
||||
assert(is.syntactic_persistence == true);
|
||||
}
|
||||
else
|
||||
{
|
||||
is.syntactic_safety = false;
|
||||
is.syntactic_guarantee = false;
|
||||
is.syntactic_recurrence = false;
|
||||
is.syntactic_persistence = false;
|
||||
}
|
||||
break;
|
||||
case Implies:
|
||||
|
|
@ -102,16 +103,20 @@ namespace spot
|
|||
is.accepting_eword = false;
|
||||
is.psl_formula = true;
|
||||
|
||||
// FIXME: if we know that the SERE has a finite language.
|
||||
// (i.e. no star). Then
|
||||
// is.syntactic_safety = second->is_syntactic_safety();
|
||||
// is.syntactic_obligation = second->is_syntactic_obligation();
|
||||
// is.syntactic_recurrence = second->is_syntactic_recurrence();
|
||||
is.syntactic_safety = false;
|
||||
is.syntactic_guarantee = second->is_syntactic_guarantee();
|
||||
is.syntactic_obligation = second->is_syntactic_guarantee();
|
||||
is.syntactic_recurrence = second->is_syntactic_guarantee();
|
||||
is.syntactic_persistence = second->is_syntactic_persistence();
|
||||
if (first->is_finite())
|
||||
{
|
||||
is.syntactic_safety = second->is_syntactic_safety();
|
||||
is.syntactic_obligation = second->is_syntactic_obligation();
|
||||
is.syntactic_recurrence = second->is_syntactic_recurrence();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.syntactic_safety = false;
|
||||
is.syntactic_obligation = second->is_syntactic_guarantee();
|
||||
is.syntactic_recurrence = second->is_syntactic_guarantee();
|
||||
}
|
||||
|
||||
assert(first->is_sere_formula());
|
||||
assert(second->is_psl_formula());
|
||||
|
|
@ -124,16 +129,20 @@ namespace spot
|
|||
is.accepting_eword = false;
|
||||
is.psl_formula = true;
|
||||
|
||||
// FIXME: if we know that the SERE has a finite language.
|
||||
// (i.e. no star). Then
|
||||
// is.syntactic_guarantee = second->is_syntactic_guarantee();
|
||||
// is.syntactic_obligation = second->is_syntactic_obligation();
|
||||
// is.syntactic_persistence = second->is_syntactic_persistence();
|
||||
is.syntactic_safety = second->is_syntactic_safety();
|
||||
is.syntactic_guarantee = false;
|
||||
is.syntactic_obligation = second->is_syntactic_safety();
|
||||
is.syntactic_recurrence = second->is_syntactic_recurrence();
|
||||
is.syntactic_persistence = second->is_syntactic_safety();
|
||||
if (first->is_finite())
|
||||
{
|
||||
is.syntactic_guarantee = second->is_syntactic_guarantee();
|
||||
is.syntactic_obligation = second->is_syntactic_obligation();
|
||||
is.syntactic_persistence = second->is_syntactic_persistence();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.syntactic_guarantee = false;
|
||||
is.syntactic_obligation = second->is_syntactic_safety();
|
||||
is.syntactic_persistence = second->is_syntactic_safety();
|
||||
}
|
||||
|
||||
assert(first->is_sere_formula());
|
||||
assert(second->is_psl_formula());
|
||||
|
|
@ -145,6 +154,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.accepting_eword = false;
|
||||
|
||||
is.syntactic_safety = false;
|
||||
|
|
@ -164,6 +174,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.accepting_eword = false;
|
||||
|
||||
// is.syntactic_safety = Safety W Safety;
|
||||
|
|
@ -183,6 +194,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.accepting_eword = false;
|
||||
|
||||
// is.syntactic_safety = Safety R Safety;
|
||||
|
|
@ -202,6 +214,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.accepting_eword = false;
|
||||
|
||||
is.syntactic_safety = false;
|
||||
|
|
|
|||
|
|
@ -51,11 +51,14 @@ namespace spot
|
|||
switch (op_)
|
||||
{
|
||||
case Star:
|
||||
if (max_ == unbounded)
|
||||
is.finite = false;
|
||||
if (min_ == 0)
|
||||
is.accepting_eword = true;
|
||||
break;
|
||||
case Equal:
|
||||
case Goto:
|
||||
is.finite = false;
|
||||
is.accepting_eword = (min_ == 0);
|
||||
// Equal and Goto can only apply to Boolean formulae.
|
||||
assert(child->is_boolean());
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace spot
|
|||
is.eltl_formula = true;
|
||||
is.psl_formula = true;
|
||||
is.sere_formula = true;
|
||||
is.finite = true;
|
||||
is.eventual = true;
|
||||
is.universal = true;
|
||||
is.syntactic_safety = true;
|
||||
|
|
@ -69,6 +70,7 @@ namespace spot
|
|||
is.eltl_formula = false;
|
||||
is.psl_formula = false;
|
||||
is.sere_formula = true;
|
||||
is.finite = true;
|
||||
is.eventual = false;
|
||||
is.syntactic_safety = false;
|
||||
is.syntactic_guarantee = false;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ namespace spot
|
|||
proprint(is_eltl_formula, "E", "ELTL formula");
|
||||
proprint(is_psl_formula, "P", "PSL formula");
|
||||
proprint(is_sere_formula, "S", "SERE formula");
|
||||
proprint(is_finite, "F", "finite");
|
||||
proprint(is_eventual, "e", "pure eventuality");
|
||||
proprint(is_universal, "u", "purely universal");
|
||||
proprint(is_syntactic_safety, "s", "syntactic safety");
|
||||
|
|
|
|||
|
|
@ -152,30 +152,37 @@ namespace spot
|
|||
return is.sugar_free_ltl;
|
||||
}
|
||||
|
||||
/// Whether the formula use only LTL operators.
|
||||
/// Whether the formula uses only LTL operators.
|
||||
bool is_ltl_formula() const
|
||||
{
|
||||
return is.ltl_formula;
|
||||
}
|
||||
|
||||
/// Whether the formula use only ELTL operators.
|
||||
/// Whether the formula uses only ELTL operators.
|
||||
bool is_eltl_formula() const
|
||||
{
|
||||
return is.eltl_formula;
|
||||
}
|
||||
|
||||
/// Whether the formula use only PSL operators.
|
||||
/// Whether the formula uses only PSL operators.
|
||||
bool is_psl_formula() const
|
||||
{
|
||||
return is.psl_formula;
|
||||
}
|
||||
|
||||
/// Whether the formula use only SERE operators.
|
||||
/// Whether the formula uses only SERE operators.
|
||||
bool is_sere_formula() const
|
||||
{
|
||||
return is.sere_formula;
|
||||
}
|
||||
|
||||
/// Whether a SERE describes a finite language, or an LTL
|
||||
/// formula uses no temporal operator but X.
|
||||
bool is_finite() const
|
||||
{
|
||||
return is.finite;
|
||||
}
|
||||
|
||||
/// \brief Whether the formula is purely eventual.
|
||||
///
|
||||
/// Pure eventuality formulae are defined in
|
||||
|
|
@ -316,6 +323,7 @@ namespace spot
|
|||
bool eltl_formula:1; // Only ELTL operators.
|
||||
bool psl_formula:1; // Only PSL operators.
|
||||
bool sere_formula:1; // Only SERE operators.
|
||||
bool finite:1; // Finite SERE formulae, or Bool+X forms.
|
||||
bool eventual:1; // Purely eventual formula.
|
||||
bool universal:1; // Purely universal formula.
|
||||
bool syntactic_safety:1; // Syntactic Safety Property.
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.sugar_free_ltl = false;
|
||||
is.eventual = true;
|
||||
is.syntactic_safety = false;
|
||||
|
|
@ -79,6 +80,7 @@ namespace spot
|
|||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.sugar_free_ltl = false;
|
||||
is.universal = true;
|
||||
// is.syntactic_safety inherited
|
||||
|
|
@ -93,6 +95,7 @@ namespace spot
|
|||
is.ltl_formula = false;
|
||||
is.psl_formula = false;
|
||||
is.sere_formula = false;
|
||||
is.finite = false;
|
||||
is.syntactic_safety = false;
|
||||
is.syntactic_guarantee = false;
|
||||
is.syntactic_obligation = false;
|
||||
|
|
@ -107,7 +110,7 @@ namespace spot
|
|||
is.eltl_formula = false;
|
||||
is.psl_formula = true;
|
||||
is.sere_formula = false;
|
||||
is.syntactic_safety = true;
|
||||
is.syntactic_safety = is.finite;
|
||||
is.syntactic_guarantee = true;
|
||||
is.syntactic_obligation = true;
|
||||
is.syntactic_recurrence = true;
|
||||
|
|
@ -121,7 +124,7 @@ namespace spot
|
|||
is.psl_formula = true;
|
||||
is.sere_formula = false;
|
||||
is.syntactic_safety = true;
|
||||
is.syntactic_guarantee = true;
|
||||
is.syntactic_guarantee = is.finite;
|
||||
is.syntactic_obligation = true;
|
||||
is.syntactic_recurrence = true;
|
||||
is.syntactic_persistence = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue