Maintain basic LTL properties using a bitfield inside formula objects.
This bitfield is easily updated as the formulae are constructed. Doing so avoids many AST recursions to compute these properties individually. This patch removes the eventual_universal_visitor, as well as the kind_of() function. * src/ltlast/formula.hh (is_boolean, is_sugar_free_boolean, is_in_nenoform, is_X_free, is_sugar_free_ltl, is_ltl_formula, is_eltl_formula, is_psl_formula, is_eventual, is_universal, is_marked): New methods to query formula properties in constant time. (get_props, ltl_prop): A method and structure for implementation as a field bit in an unsigned, for fast computation. (print_formula_props): New function. * src/ltlast/formula.cc (print_formula_props): Implement it. * src/ltlast/atomic_prop.cc, src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc, src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlast/automatop.cc: Compute the properties as instances are constructed. * src/ltlparse/ltlparse.yy: Update to use is_boolean() instead of kind_of(). * src/ltltest/kind.cc: Update to use print_formula_props(). * src/ltltest/kind.test: Adjust to test eventual and universal properties. * src/ltlvisit/kind.cc, src/ltlvisit/kind.hh: Delete these files. * src/ltlvisit/Makefile.am: Remove kind.hh and kind.cc. * src/ltlvisit/reduce.cc (recurse_eu, eventual_universal_visitor): Remove, no longer needed. (reduce_visitor, is_eventual, is_universal): Adjust to use formula::is_eventual(), and formula::is_universal(). * src/ltlvisit/reduce.hh (is_eventual, is_universal): Declare as deprecated.
This commit is contained in:
parent
1671aa5da1
commit
546260e7a0
17 changed files with 408 additions and 488 deletions
|
|
@ -22,7 +22,6 @@
|
|||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/kind.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
|
|
@ -44,9 +43,8 @@ main(int argc, char **argv)
|
|||
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
|
||||
return 2;
|
||||
|
||||
unsigned k = spot::ltl::kind_of(f1);
|
||||
spot::ltl::print_kind(std::cout, k, true) << " = ";
|
||||
spot::ltl::print_kind(std::cout, k, false) << std::endl;
|
||||
spot::ltl::print_formula_props(std::cout, f1, true) << " = ";
|
||||
spot::ltl::print_formula_props(std::cout, f1, false) << std::endl;
|
||||
|
||||
f1->destroy();
|
||||
assert(spot::ltl::atomic_prop::instance_count() == 0);
|
||||
|
|
|
|||
|
|
@ -37,12 +37,18 @@ check 'a' 'B&!xfLEP'
|
|||
check 'a<->b' 'BxfLEP'
|
||||
check '!a' 'B&!xfLEP'
|
||||
check '!(a|b)' 'B&xfLEP'
|
||||
check 'F(a)' '&!xLPe'
|
||||
check 'G(a)' '&!xLPu'
|
||||
check 'a U b' '&!xfLP'
|
||||
check 'a U Fb' '&!xLP'
|
||||
check 'Ga U b' '&!xLP'
|
||||
check '1 U a' '&!xfLPe'
|
||||
check 'a W b' '&!xfLP'
|
||||
check 'a W 0' '&!xfLPu'
|
||||
check 'a M b' '&!xfLP'
|
||||
check 'a M 1' '&!xfLPe'
|
||||
check 'a R b' '&!xfLP'
|
||||
check '0 R b' '&!xfLPu'
|
||||
check '{a}|->!Xb' '&fP'
|
||||
check '{a}|->X!b' '&!fP'
|
||||
check '{a}|->!Gb' '&xP'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue