Replace the constant_term visitor by a flag in the formulae.
* src/ltlast/formula.hh (formula::accepts_eword): New method. (formula::is.accepting_eword): New flag. * src/ltlast/formula.cc (print_formula_props): Display the new property. * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc, src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc, src/ltlast/multop.cc, src/ltlast/unop.cc: Update is.accepting_eword as appropriate. * src/ltltest/consterm.cc, src/tgbaalgos/ltl2tgba_fm.cc: Adjust to use accepts_eword(). * src/ltlvisit/consterm.cc, src/ltlvisit/consterm.hh: Delete. * src/ltlvisit/Makefile.am: Remove these files.
This commit is contained in:
parent
546260e7a0
commit
48cde88b9b
14 changed files with 73 additions and 268 deletions
|
|
@ -45,6 +45,7 @@ namespace spot
|
|||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.not_marked = true;
|
||||
is.accepting_eword = false;
|
||||
}
|
||||
|
||||
atomic_prop::~atomic_prop()
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ namespace spot
|
|||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.not_marked = true;
|
||||
is.accepting_eword = false;
|
||||
|
||||
unsigned s = v->size();
|
||||
for (unsigned i = 0; i < s; ++i)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ namespace spot
|
|||
case Equiv:
|
||||
is.sugar_free_boolean = false;
|
||||
is.in_nenoform = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case EConcatMarked:
|
||||
is.not_marked = false;
|
||||
|
|
@ -65,6 +66,7 @@ namespace spot
|
|||
is.ltl_formula = false;
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case U:
|
||||
// 1 U a = Fa
|
||||
|
|
@ -72,6 +74,7 @@ namespace spot
|
|||
is.eventual = 1;
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case W:
|
||||
// a W 0 = Ga
|
||||
|
|
@ -79,6 +82,7 @@ namespace spot
|
|||
is.universal = 1;
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case R:
|
||||
// 0 R a = Ga
|
||||
|
|
@ -86,6 +90,7 @@ namespace spot
|
|||
is.universal = 1;
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case M:
|
||||
// a M 1 = Fa
|
||||
|
|
@ -93,6 +98,7 @@ namespace spot
|
|||
is.eventual = 1;
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,16 +35,21 @@ namespace spot
|
|||
{
|
||||
props = child->get_props();
|
||||
|
||||
is.boolean = false;
|
||||
is.ltl_formula = false;
|
||||
is.eltl_formula = false;
|
||||
is.eventual = false;
|
||||
is.universal = false;
|
||||
|
||||
switch (op_)
|
||||
{
|
||||
case Equal:
|
||||
case Star:
|
||||
if (min_ == 0)
|
||||
is.accepting_eword = true;
|
||||
break;
|
||||
case Equal:
|
||||
case Goto:
|
||||
is.boolean = false;
|
||||
is.ltl_formula = false;
|
||||
is.eltl_formula = false;
|
||||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.accepting_eword = (min_ == 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ namespace spot
|
|||
is.eventual = true;
|
||||
is.universal = true;
|
||||
is.not_marked = true;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case constant::EmptyWord:
|
||||
is.boolean = false;
|
||||
|
|
@ -64,6 +65,7 @@ namespace spot
|
|||
is.eventual = false;
|
||||
is.universal = false;
|
||||
is.not_marked = true;
|
||||
is.accepting_eword = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ namespace spot
|
|||
proprint(is_eventual, "e", "pure eventuality");
|
||||
proprint(is_universal, "u", "purely universal");
|
||||
proprint(is_marked, "+", "marked");
|
||||
proprint(accepts_eword, "0", "accepts the empty word");
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,12 @@ namespace spot
|
|||
return !is.not_marked;
|
||||
}
|
||||
|
||||
/// Whether the formula accepts [*0].
|
||||
bool accepts_eword() const
|
||||
{
|
||||
return is.accepting_eword;
|
||||
}
|
||||
|
||||
/// The properties as a field of bits. For internal use.
|
||||
unsigned get_props() const
|
||||
{
|
||||
|
|
@ -252,7 +258,7 @@ namespace spot
|
|||
// "the formula is".
|
||||
bool boolean:1; // No temporal operators.
|
||||
bool sugar_free_boolean:1; // Only AND, OR, and NOT operators.
|
||||
bool in_nenoform:1; // Negative Normal Form
|
||||
bool in_nenoform:1; // Negative Normal Form.
|
||||
bool X_free:1; // No X operators.
|
||||
bool sugar_free_ltl:1; // No F and G operators.
|
||||
bool ltl_formula:1; // Only LTL operators.
|
||||
|
|
@ -260,7 +266,8 @@ namespace spot
|
|||
bool psl_formula:1; // Only PSL operators.
|
||||
bool eventual:1; // Purely eventual formula.
|
||||
bool universal:1; // Purely universal formula.
|
||||
bool not_marked:1; // No occurrence of EConcatMarked
|
||||
bool not_marked:1; // No occurrence of EConcatMarked.
|
||||
bool accepting_eword:1; // Accepts the empty word.
|
||||
};
|
||||
union
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "multop.hh"
|
||||
#include "constant.hh"
|
||||
#include "visitor.hh"
|
||||
#include "ltlvisit/consterm.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -40,10 +39,6 @@ namespace spot
|
|||
unsigned s = v->size();
|
||||
assert(s > 1);
|
||||
|
||||
props = (*v)[0]->get_props();
|
||||
for (unsigned i = 1; i < s; ++i)
|
||||
props &= (*v)[i]->get_props();
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case Concat:
|
||||
|
|
@ -53,15 +48,29 @@ namespace spot
|
|||
is.eltl_formula = false;
|
||||
is.eventual = false;
|
||||
is.universal = false;
|
||||
break;
|
||||
// fall through
|
||||
case AndNLM:
|
||||
// The non-matching-length-And (&) can only appear in the
|
||||
// rational parts of PSL formula. We don't remove the
|
||||
// Boolean flag, because applied to atomic propositions a&b
|
||||
// has the same effect as a&&b.
|
||||
case And:
|
||||
case Or:
|
||||
props = (*v)[0]->get_props();
|
||||
for (unsigned i = 1; i < s; ++i)
|
||||
props &= (*v)[i]->get_props();
|
||||
break;
|
||||
case Or:
|
||||
{
|
||||
bool ew = (*v)[0]->accepts_eword();
|
||||
props = (*v)[0]->get_props();
|
||||
for (unsigned i = 1; i < s; ++i)
|
||||
{
|
||||
ew |= (*v)[i]->accepts_eword();
|
||||
props &= (*v)[i]->get_props();
|
||||
}
|
||||
is.accepting_eword = ew;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,21 +289,20 @@ namespace spot
|
|||
++i;
|
||||
}
|
||||
}
|
||||
// We have a* & [*0] & 0 = 0 // already checked above
|
||||
// but a* & [*0] & c* = [*0]
|
||||
// So if [*0] has been seen, check if all term recognize the
|
||||
// We have a* & [*0] & c = 0
|
||||
// and a* & [*0] & c* = [*0]
|
||||
// So if [*0] has been seen, check if alls term recognize the
|
||||
// empty word.
|
||||
if (weak_abs_seen)
|
||||
{
|
||||
bool acc_empty = true;
|
||||
bool acc_eword = true;
|
||||
for (i = v->begin(); i != v->end(); ++i)
|
||||
{
|
||||
if (acc_empty)
|
||||
acc_empty = constant_term_as_bool(*i);
|
||||
acc_eword &= (*i)->accepts_eword();
|
||||
(*i)->destroy();
|
||||
}
|
||||
delete v;
|
||||
if (acc_empty)
|
||||
if (acc_eword)
|
||||
return weak_abs;
|
||||
else
|
||||
return constant::false_instance();
|
||||
|
|
|
|||
|
|
@ -40,34 +40,40 @@ namespace spot
|
|||
{
|
||||
case Not:
|
||||
is.in_nenoform = !!dynamic_cast<atomic_prop*>(child);
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case X:
|
||||
is.boolean = false;
|
||||
is.X_free = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case F:
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sugar_free_ltl = false;
|
||||
is.eventual = true;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case G:
|
||||
is.boolean = false;
|
||||
is.eltl_formula = false;
|
||||
is.sugar_free_ltl = false;
|
||||
is.universal = true;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case Finish:
|
||||
is.boolean = false;
|
||||
is.ltl_formula = false;
|
||||
is.psl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
case Closure:
|
||||
case NegClosure:
|
||||
is.boolean = false;
|
||||
is.ltl_formula = false;
|
||||
is.eltl_formula = false;
|
||||
is.accepting_eword = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue