Trivially reduce 1[*]&&f = f and 1[*]|f = 1[*].

* src/ltlast/bunop.hh (one_star): New static method building 1[*].
* src/ltlast/bunop.cc (bunop::~bunop, bunop::instance_count): Adjust.
* src/ltlast/multop.cc: Implement the trivial rewriting.
* src/ltlast/multop.hh, doc/tl/tl.tex: Document it.
* src/ltltest/equals.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2012-04-24 17:22:23 +02:00
parent 5bea6e4950
commit e06b3b7974
6 changed files with 39 additions and 6 deletions

View file

@ -26,6 +26,7 @@
#include <map>
#include <iosfwd>
#include "refformula.hh"
#include "constant.hh"
namespace spot
{
@ -116,6 +117,18 @@ namespace spot
/// Dump all instances. For debugging.
static std::ostream& dump_instances(std::ostream& os);
/// \brief Return a formula for <code>1[*]</code>.
///
/// A global instance is returned, and it should not be
/// destroyed. Remember to clone it if you use it to build a
/// formula.
static formula* one_star()
{
if (!one_star_)
one_star_ = instance(Star, constant::true_instance());
return one_star_;
}
protected:
typedef std::pair<unsigned, unsigned> pairu;
typedef std::pair<type, formula*> pairo;
@ -131,6 +144,7 @@ namespace spot
formula* child_;
unsigned min_;
unsigned max_;
static formula* one_star_;
};
/// \brief Cast \a f into a bunop.