Add support for {SERE} and !{SERE} closure operators.

* src/ltlast/unop.hh, src/ltlast/unop.cc: Introduce Closure and
NegClosure operators.
* src/ltlparse/ltlparse.yy: Recognize {foo} as a Closure.
* src/ltlvisit/mark.cc: Consider NegClosure as a marked operator.
* src/tgbaalgos/ltl2tgba_fm.cc (ratexp_trad_visitor): Add option to
select whether the empty_word should act like true (for {SERE}
and {!SERE}) or false (for {SERE}<>->Exp or {SERE}[]->Exp).
(ltl_trad_visitor): Translate Closure and NegClosure.
* src/tgbatest/ltl2tgba.test: Add more tests.
* src/ltlvisit/basicreduce.cc, src/ltlvisit/consterm.cc,
src/ltlvisit/nenoform.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc,
src/ltlvisit/tunabbrev.cc, src/tgba/formula2bdd.cc,
src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2tgba_lacim.cc,
src/tgbaalgos/ltl2taa.cc: Straightforward update to support or
assert on these new operators.
This commit is contained in:
Alexandre Duret-Lutz 2010-03-09 09:48:08 +01:00
parent f618e6bc1a
commit 2f8c4ac8b7
17 changed files with 343 additions and 74 deletions

View file

@ -1,8 +1,8 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et D<EFBFBD>veloppement
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), d<EFBFBD>partement Syst<73>mes R<>partis Coop<6F>ratifs (SRC),
// Universit<EFBFBD> Pierre et Marie Curie.
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -101,6 +101,10 @@ namespace spot
return "Finish";
case Star:
return "Star";
case Closure:
return "Closure";
case NegClosure:
return "NegClosure";
}
// Unreachable code.
assert(0);
@ -145,7 +149,7 @@ namespace spot
if (child == constant::empty_word_instance())
return constant::true_instance();
}
break;
case Not:
{
@ -155,13 +159,30 @@ namespace spot
// !0 = 1
if (child == constant::false_instance())
return constant::true_instance();
// Not is an involution.
unop* u = dynamic_cast<unop*>(child);
if (u && u->op() == op)
if (u)
{
formula* c = u->child()->clone();
u->destroy();
return c;
// "Not" is an involution.
if (u->op() == op)
{
formula* c = u->child()->clone();
u->destroy();
return c;
}
if (u->op() == Closure)
{
formula* c = unop::instance(NegClosure,
u->child()->clone());
u->destroy();
return c;
}
if (u->op() == NegClosure)
{
formula* c = unop::instance(Closure,
u->child()->clone());
u->destroy();
return c;
}
}
break;
}
@ -179,6 +200,22 @@ namespace spot
case Finish:
// No simplifications for Finish.
break;
case Closure:
if (child == constant::true_instance()
|| child == constant::empty_word_instance())
return constant::true_instance();
if (child == constant::false_instance())
return child;
break;
case NegClosure:
if (child == constant::true_instance()
|| child == constant::empty_word_instance())
return constant::false_instance();
if (child == constant::false_instance())
return constant::true_instance();
break;
}
pair p(op, child);

View file

@ -1,8 +1,8 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et D<EFBFBD>veloppement
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
// 6 (LIP6), d<EFBFBD>partement Syst<73>mes R<>partis Coop<6F>ratifs (SRC),
// Universit<EFBFBD> Pierre et Marie Curie.
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -47,6 +47,8 @@ namespace spot
Finish,
// Kleene Star
Star,
// Closure
Closure, NegClosure,
};
/// \brief Build an unary operator with operation \a op and
@ -69,6 +71,14 @@ namespace spot
/// - !1 = 0
/// - !0 = 1
/// - !!Exp = Exp
/// - !Closure(Exp) = NegClosure(Exp)
/// - !NegClosure(Exp) = Closure(Exp)
/// - Closure(#e) = 1
/// - Closure(1) = 1
/// - Closure(0) = 0
/// - NegClosure(#e) = 0
/// - NegClosure(1) = 0
/// - NegClosure(0) = 1
///
/// This rewriting implies that it is not possible to build an
/// LTL formula object that is SYNTACTICALLY equal to one of