spot
0.9.1
|
Multi-operand operators. More...
#include <ltlast/multop.hh>
Classes | |
struct | paircmp |
Comparison functor used internally by ltl::multop. More... | |
Public Types | |
enum | type { Or, OrRat, And, AndRat, AndNLM, Concat, Fusion } |
typedef std::vector< const formula * > | vec |
List of formulae. | |
enum | opkind { Constant, AtomicProp, UnOp, BinOp, MultOp, BUnOp, AutomatOp } |
Kind of a sub-formula. More... | |
Public Member Functions | |
virtual void | accept (visitor &v) const |
Entry point for spot::ltl::visitor instances. | |
unsigned | size () const |
Get the number of children. | |
const formula * | nth (unsigned n) const |
Get the nth child. | |
const formula * | all_but (unsigned n) const |
construct a formula without the nth child. | |
type | op () const |
Get the type of this operator. | |
const char * | op_name () const |
Get the type of this operator, as a string. | |
virtual std::string | dump () const |
Return a canonic representation of the atomic proposition. | |
const formula * | clone () const |
clone this node | |
void | destroy () const |
release this node | |
opkind | kind () const |
Return the kind of the top-level operator. | |
bool | is_boolean () const |
Whether the formula use only boolean operators. | |
bool | is_sugar_free_boolean () const |
Whether the formula use only AND, OR, and NOT operators. | |
bool | is_in_nenoform () const |
Whether the formula is in negative normal form. | |
bool | is_X_free () const |
Whether the formula avoids the X operator. | |
bool | is_sugar_free_ltl () const |
Whether the formula avoids the F and G operators. | |
bool | is_ltl_formula () const |
Whether the formula uses only LTL operators. | |
bool | is_eltl_formula () const |
Whether the formula uses only ELTL operators. | |
bool | is_psl_formula () const |
Whether the formula uses only PSL operators. | |
bool | is_sere_formula () const |
Whether the formula uses only SERE operators. | |
bool | is_finite () const |
bool | is_eventual () const |
Whether the formula is purely eventual. | |
bool | is_universal () const |
Whether a formula is purely universal. | |
bool | is_syntactic_safety () const |
Whether a PSL/LTL formula is syntactic safety property. | |
bool | is_syntactic_guarantee () const |
Whether a PSL/LTL formula is syntactic guarantee property. | |
bool | is_syntactic_obligation () const |
Whether a PSL/LTL formula is syntactic obligation property. | |
bool | is_syntactic_recurrence () const |
Whether a PSL/LTL formula is syntactic recurrence property. | |
bool | is_syntactic_persistence () const |
Whether a PSL/LTL formula is syntactic persistence property. | |
bool | is_marked () const |
Whether the formula has an occurrence of EConcatMarked. | |
bool | accepts_eword () const |
Whether the formula accepts [*0]. | |
unsigned | get_props () const |
The properties as a field of bits. For internal use. | |
size_t | hash () const |
Return a hash key for the formula. | |
Static Public Member Functions | |
static const formula * | instance (type op, const formula *first, const formula *second) |
Build a spot::ltl::multop with two children. | |
static const formula * | instance (type op, vec *v) |
Build a spot::ltl::multop with many children. | |
static unsigned | instance_count () |
Number of instantiated multi-operand operators. For debugging. | |
static std::ostream & | dump_instances (std::ostream &os) |
Dump all instances. For debugging. | |
Protected Types | |
typedef std::pair< type, vec * > | pair |
typedef std::map< pair, const multop *, paircmp > | map |
Protected Member Functions | |
multop (type op, vec *v) | |
virtual | ~multop () |
void | ref_ () const |
increment reference counter if any | |
bool | unref_ () const |
decrement reference counter if any, return true when the instance must be deleted (usually when the counter hits 0). | |
unsigned | ref_count_ () const |
Number of references to this formula. | |
Protected Attributes | |
size_t | count_ |
The hash key of this formula. | |
union { | |
unsigned props | |
ltl_prop is | |
}; | |
Static Protected Attributes | |
static map | instances |
Private Attributes | |
type | op_ |
vec * | children_ |
Multi-operand operators.
typedef std::map<pair, const multop*, paircmp> spot::ltl::multop::map [protected] |
typedef std::pair<type, vec*> spot::ltl::multop::pair [protected] |
typedef std::vector<const formula*> spot::ltl::multop::vec |
List of formulae.
enum spot::ltl::formula::opkind [inherited] |
spot::ltl::multop::multop | ( | type | op, |
vec * | v | ||
) | [protected] |
virtual spot::ltl::multop::~multop | ( | ) | [protected, virtual] |
virtual void spot::ltl::multop::accept | ( | visitor & | v | ) | const [virtual] |
Entry point for spot::ltl::visitor instances.
Implements spot::ltl::formula.
bool spot::ltl::formula::accepts_eword | ( | ) | const [inline, inherited] |
Whether the formula accepts [*0].
References spot::ltl::formula::ltl_prop::accepting_eword, and spot::ltl::formula::is.
const formula* spot::ltl::multop::all_but | ( | unsigned | n | ) | const |
construct a formula without the nth child.
If the formula f
is a|b|c|d
and d
is child number 2, then calling f->all_but(2)
will return a new formula a|b|d
.
const formula* spot::ltl::formula::clone | ( | ) | const [inherited] |
clone this node
This increments the reference counter of this node (if one is used).
void spot::ltl::formula::destroy | ( | ) | const [inherited] |
release this node
This decrements the reference counter of this node (if one is used) and can free the object.
Referenced by spot::taa_tgba_labelled< std::string, string_hash >::add_acceptance_condition(), spot::explicit_graph< State, tgba >::add_condition(), spot::explicit_graph< State, tgba >::declare_acceptance_condition(), spot::destroy_key< const ltl::formula * >::destroy(), and spot::explicit_graph< State, tgba >::get_acceptance_condition().
virtual std::string spot::ltl::multop::dump | ( | ) | const [virtual] |
Return a canonic representation of the atomic proposition.
Implements spot::ltl::formula.
static std::ostream& spot::ltl::multop::dump_instances | ( | std::ostream & | os | ) | [static] |
Dump all instances. For debugging.
unsigned spot::ltl::formula::get_props | ( | ) | const [inline, inherited] |
The properties as a field of bits. For internal use.
References spot::ltl::formula::props.
size_t spot::ltl::formula::hash | ( | ) | const [inline, inherited] |
Return a hash key for the formula.
References spot::ltl::formula::count_.
Referenced by spot::ltl::formula_ptr_less_than::operator()(), and spot::ltl::formula_ptr_hash::operator()().
static const formula* spot::ltl::multop::instance | ( | type | op, |
const formula * | first, | ||
const formula * | second | ||
) | [static] |
Build a spot::ltl::multop with two children.
If one of the children itself is a spot::ltl::multop with the same type, it will be inlined. I.e., children of that child will be added, and that child itself will be destroyed. This allows incremental building of n-ary ltl::multop.
This functions can perform slight optimizations and may not return an ltl::multop object. See the other instance function for the list of rewritings.
static const formula* spot::ltl::multop::instance | ( | type | op, |
vec * | v | ||
) | [static] |
Build a spot::ltl::multop with many children.
Same as the other instance() function, but take a vector of formulae as argument. This vector is acquired by the spot::ltl::multop class, the caller should allocate it with new
, but not use it (especially not destroy it) after it has been passed to spot::ltl::multop. Inside the vector, null pointers are ignored.
Most operators (Or, OrRat, And, AndRat, Concat) are associative, and are automatically inlined. Or, OrRat, And, and AndRat are commutative, so their arguments are also sorted, to ensure that "a & b" is equal to "b & a", also duplicate arguments are removed.
Furthermore this function can perform slight optimizations and may not return an ltl::multop object. For instance if the vector contains only one unique element, this this formula will be returned as-is. Neutral and absorbent element are also taken care of. The following rewritings are performed (the left patterns are rewritten as shown on the right):
static unsigned spot::ltl::multop::instance_count | ( | ) | [static] |
Number of instantiated multi-operand operators. For debugging.
bool spot::ltl::formula::is_boolean | ( | ) | const [inline, inherited] |
Whether the formula use only boolean operators.
References spot::ltl::formula::ltl_prop::boolean, and spot::ltl::formula::is.
bool spot::ltl::formula::is_eltl_formula | ( | ) | const [inline, inherited] |
Whether the formula uses only ELTL operators.
References spot::ltl::formula::ltl_prop::eltl_formula, and spot::ltl::formula::is.
bool spot::ltl::formula::is_eventual | ( | ) | const [inline, inherited] |
Whether the formula is purely eventual.
Pure eventuality formulae are defined in
/// @InProceedings{ etessami.00.concur, /// author = {Kousha Etessami and Gerard J. Holzmann}, /// title = {Optimizing {B\"u}chi Automata}, /// booktitle = {Proceedings of the 11th International Conference on /// Concurrency Theory (Concur'2000)}, /// pages = {153--167}, /// year = {2000}, /// editor = {C. Palamidessi}, /// volume = {1877}, /// series = {Lecture Notes in Computer Science}, /// publisher = {Springer-Verlag} /// } ///
A word that satisfies a pure eventuality can be prefixed by anything and still satisfies the formula.
References spot::ltl::formula::ltl_prop::eventual, and spot::ltl::formula::is.
bool spot::ltl::formula::is_finite | ( | ) | const [inline, inherited] |
Whether a SERE describes a finite language, or an LTL formula uses no temporal operator but X.
References spot::ltl::formula::ltl_prop::finite, and spot::ltl::formula::is.
bool spot::ltl::formula::is_in_nenoform | ( | ) | const [inline, inherited] |
Whether the formula is in negative normal form.
A formula is in negative normal form if the not operators occur only in front of atomic propositions.
References spot::ltl::formula::ltl_prop::in_nenoform, and spot::ltl::formula::is.
bool spot::ltl::formula::is_ltl_formula | ( | ) | const [inline, inherited] |
Whether the formula uses only LTL operators.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::ltl_formula.
bool spot::ltl::formula::is_marked | ( | ) | const [inline, inherited] |
Whether the formula has an occurrence of EConcatMarked.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::not_marked.
bool spot::ltl::formula::is_psl_formula | ( | ) | const [inline, inherited] |
Whether the formula uses only PSL operators.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::psl_formula.
bool spot::ltl::formula::is_sere_formula | ( | ) | const [inline, inherited] |
Whether the formula uses only SERE operators.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::sere_formula.
bool spot::ltl::formula::is_sugar_free_boolean | ( | ) | const [inline, inherited] |
Whether the formula use only AND, OR, and NOT operators.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::sugar_free_boolean.
bool spot::ltl::formula::is_sugar_free_ltl | ( | ) | const [inline, inherited] |
Whether the formula avoids the F and G operators.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::sugar_free_ltl.
bool spot::ltl::formula::is_syntactic_guarantee | ( | ) | const [inline, inherited] |
Whether a PSL/LTL formula is syntactic guarantee property.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::syntactic_guarantee.
bool spot::ltl::formula::is_syntactic_obligation | ( | ) | const [inline, inherited] |
Whether a PSL/LTL formula is syntactic obligation property.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::syntactic_obligation.
bool spot::ltl::formula::is_syntactic_persistence | ( | ) | const [inline, inherited] |
Whether a PSL/LTL formula is syntactic persistence property.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::syntactic_persistence.
bool spot::ltl::formula::is_syntactic_recurrence | ( | ) | const [inline, inherited] |
Whether a PSL/LTL formula is syntactic recurrence property.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::syntactic_recurrence.
bool spot::ltl::formula::is_syntactic_safety | ( | ) | const [inline, inherited] |
Whether a PSL/LTL formula is syntactic safety property.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::syntactic_safety.
bool spot::ltl::formula::is_universal | ( | ) | const [inline, inherited] |
Whether a formula is purely universal.
Purely universal formulae are defined in
/// @InProceedings{ etessami.00.concur, /// author = {Kousha Etessami and Gerard J. Holzmann}, /// title = {Optimizing {B\"u}chi Automata}, /// booktitle = {Proceedings of the 11th International Conference on /// Concurrency Theory (Concur'2000)}, /// pages = {153--167}, /// year = {2000}, /// editor = {C. Palamidessi}, /// volume = {1877}, /// series = {Lecture Notes in Computer Science}, /// publisher = {Springer-Verlag} /// } ///
Any (non-empty) suffix of a word that satisfies a purely universal formula also satisfies the formula.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::universal.
bool spot::ltl::formula::is_X_free | ( | ) | const [inline, inherited] |
Whether the formula avoids the X operator.
References spot::ltl::formula::is, and spot::ltl::formula::ltl_prop::X_free.
opkind spot::ltl::formula::kind | ( | ) | const [inline, inherited] |
Return the kind of the top-level operator.
References spot::ltl::formula::kind_.
Referenced by spot::ltl::is_atomic_prop(), spot::ltl::is_binop(), spot::ltl::is_bunop(), spot::ltl::is_constant(), spot::ltl::is_multop(), and spot::ltl::is_unop().
const formula* spot::ltl::multop::nth | ( | unsigned | n | ) | const |
Get the nth child.
Starting with n = 0.
type spot::ltl::multop::op | ( | ) | const |
Get the type of this operator.
const char* spot::ltl::multop::op_name | ( | ) | const |
Get the type of this operator, as a string.
void spot::ltl::ref_formula::ref_ | ( | ) | const [protected, virtual, inherited] |
increment reference counter if any
Reimplemented from spot::ltl::formula.
unsigned spot::ltl::ref_formula::ref_count_ | ( | ) | const [protected, inherited] |
Number of references to this formula.
unsigned spot::ltl::multop::size | ( | ) | const |
Get the number of children.
bool spot::ltl::ref_formula::unref_ | ( | ) | const [protected, virtual, inherited] |
decrement reference counter if any, return true when the instance must be deleted (usually when the counter hits 0).
Reimplemented from spot::ltl::formula.
union { ... } [protected, inherited] |
vec* spot::ltl::multop::children_ [private] |
size_t spot::ltl::formula::count_ [protected, inherited] |
The hash key of this formula.
Referenced by spot::ltl::formula::hash().
map spot::ltl::multop::instances [static, protected] |
ltl_prop spot::ltl::formula::is [inherited] |
Referenced by spot::ltl::formula::accepts_eword(), spot::ltl::formula::is_boolean(), spot::ltl::formula::is_eltl_formula(), spot::ltl::formula::is_eventual(), spot::ltl::formula::is_finite(), spot::ltl::formula::is_in_nenoform(), spot::ltl::formula::is_ltl_formula(), spot::ltl::formula::is_marked(), spot::ltl::formula::is_psl_formula(), spot::ltl::formula::is_sere_formula(), spot::ltl::formula::is_sugar_free_boolean(), spot::ltl::formula::is_sugar_free_ltl(), spot::ltl::formula::is_syntactic_guarantee(), spot::ltl::formula::is_syntactic_obligation(), spot::ltl::formula::is_syntactic_persistence(), spot::ltl::formula::is_syntactic_recurrence(), spot::ltl::formula::is_syntactic_safety(), spot::ltl::formula::is_universal(), and spot::ltl::formula::is_X_free().
type spot::ltl::multop::op_ [private] |
unsigned spot::ltl::formula::props [inherited] |
Referenced by spot::ltl::formula::get_props().