ltl: keep track of spin-compatible AP

* src/misc/bareword.cc, src/misc/bareword.hh (is_spin_ap): New function.
* src/ltlast/formula.cc, src/ltlast/formula.hh (is_spin_atomic_props):
New method and boolean.
* src/ltlast/atomic_prop.cc, src/ltlast/constant.cc: Update it.
* src/ltltest/kind.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2015-01-27 10:21:17 +01:00
parent 16a8c03143
commit a4a0cf3bb2
7 changed files with 143 additions and 108 deletions

View file

@ -23,6 +23,7 @@
#include "config.h"
#include "atomic_prop.hh"
#include "visitor.hh"
#include "misc/bareword.hh"
#include <cstddef>
#include <cassert>
#include <ostream>
@ -60,12 +61,14 @@ namespace spot
// is.lbt_atomic_props should be true if the name has the form
// pNN where NN is any number of digit.
std::string::const_iterator pos = name.begin();
is.lbt_atomic_props = (pos != name.end() && *pos++ == 'p');
while (is.lbt_atomic_props && pos != name.end())
bool lbtap = (pos != name.end() && *pos++ == 'p');
while (lbtap && pos != name.end())
{
char l = *pos++;
is.lbt_atomic_props = (l >= '0' && l <= '9');
lbtap = (l >= '0' && l <= '9');
}
is.lbt_atomic_props = lbtap;
is.spin_atomic_props = lbtap || is_spin_ap(name.c_str());
}
atomic_prop::~atomic_prop()

View file

@ -59,6 +59,8 @@ namespace spot
is.syntactic_persistence = true;
is.not_marked = true;
is.accepting_eword = false;
is.lbt_atomic_props = true;
is.spin_atomic_props = true;
break;
case constant::EmptyWord:
is.boolean = false;
@ -80,6 +82,8 @@ namespace spot
is.universal = false;
is.not_marked = true;
is.accepting_eword = true;
is.lbt_atomic_props = true;
is.spin_atomic_props = true;
break;
}
}

View file

@ -56,7 +56,10 @@ namespace spot
proprint(is_syntactic_recurrence, "r", "syntactic recurrence"); \
proprint(is_marked, "+", "marked"); \
proprint(accepts_eword, "0", "accepts the empty word"); \
proprint(has_lbt_atomic_props, "l", "has LBT-style atomic props");
proprint(has_lbt_atomic_props, "l", \
"has LBT-style atomic props"); \
proprint(has_spin_atomic_props, "a", \
"has Spin-style atomic props");
std::list<std::string>

View file

@ -293,6 +293,11 @@ namespace spot
return is.lbt_atomic_props;
}
bool has_spin_atomic_props() const
{
return is.spin_atomic_props;
}
/// The properties as a field of bits. For internal use.
unsigned get_props() const
{
@ -354,6 +359,7 @@ namespace spot
bool not_marked:1; // No occurrence of EConcatMarked.
bool accepting_eword:1; // Accepts the empty word.
bool lbt_atomic_props:1; // Use only atomic propositions like p42.
bool spin_atomic_props:1; // Use only spin-compatible atomic props.
};
union
{