Add a has_lbt_atomic_props() method to LTL formulas.

* src/ltlast/formula.hh (has_lbt_atomic_props): New method.
* src/ltlast/formula.cc (printprops): Display it.
* src/ltlast/atomic_prop.cc: Update it.
* src/bin/ltlcheck.cc, src/bin/genltl.cc: Use it.
* doc/tl/tl.tex: Menton has_lbt_atomic_props().
This commit is contained in:
Alexandre Duret-Lutz 2012-10-14 15:52:53 +02:00
parent f40925f67b
commit b2de0136b2
6 changed files with 46 additions and 7 deletions

View file

@ -802,7 +802,7 @@ output_pattern(int pattern, int n)
// Make sure we use only "p42"-style of atomic propositions
// in lbt's output.
if (output_format == lbt_output)
if (output_format == lbt_output && !f->has_lbt_atomic_props())
{
const spot::ltl::formula* r = spot::ltl::relabel(f, spot::ltl::Pnn);
f->destroy();

View file

@ -41,6 +41,7 @@
#include "ltlvisit/tostring.hh"
#include "ltlvisit/apcollect.hh"
#include "ltlvisit/lbt.hh"
#include "ltlvisit/relabel.hh"
#include "tgbaalgos/lbtt.hh"
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/gtec/gtec.hh"
@ -414,6 +415,8 @@ namespace
// Run-specific variables
printable_result_filename output;
public:
using spot::formater::has;
translator_runner()
{
declare('f', &string_ltl_spot);
@ -704,6 +707,16 @@ namespace
pstats->resize(m);
nstats->resize(m);
// If we need LBT atomic proposition in any of the input or
// output, relabel the formula.
if (!f->has_lbt_atomic_props() &&
(runner.has('l') || runner.has('L') || runner.has('T')))
{
const spot::ltl::formula* g = spot::ltl::relabel(f, spot::ltl::Pnn);
f->destroy();
f = g;
}
// ---------- Positive Formula ----------
runner.round_formula(f, round);

View file

@ -52,6 +52,15 @@ namespace spot
is.syntactic_persistence = true;
is.not_marked = true;
is.accepting_eword = false;
// 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())
{
char l = *pos++;
is.lbt_atomic_props = (l >= '0' && l <= '9');
}
}
atomic_prop::~atomic_prop()

View file

@ -81,7 +81,8 @@ namespace spot
proprint(is_syntactic_persistence, "p", "syntactic persistence"); \
proprint(is_syntactic_recurrence, "r", "syntactic recurrence"); \
proprint(is_marked, "+", "marked"); \
proprint(accepts_eword, "0", "accepts the empty word");
proprint(accepts_eword, "0", "accepts the empty word"); \
proprint(has_lbt_atomic_props, "l", "as LBT-style atomic props");
std::list<std::string>

View file

@ -275,6 +275,11 @@ namespace spot
return is.accepting_eword;
}
bool has_lbt_atomic_props() const
{
return is.lbt_atomic_props;
}
/// The properties as a field of bits. For internal use.
unsigned get_props() const
{
@ -333,6 +338,7 @@ namespace spot
bool syntactic_persistence:1; // Syntactic Persistence Property.
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.
};
union
{