Move the remaining reduce() logic into ltl_simplifier.
* src/ltlvisit/simplify.hh (ltl_simplifier::negative_normal_form): Allow logical unabbreviations during the NNF pass. * src/ltlvisit/simplify.cc (ltl_simplifier::negative_normal_form) (negative_normal_form_visitor): Adjust. (ltl_simplifier::simplify): Request unabbreviations. * src/ltlvisit/reduce.cc (reduce): Remove most of the code, leaving only a call ltl_simplifier and some wrapper code to convert options. * src/ltltest/reduccmp.test: Add more test cases.
This commit is contained in:
parent
d4d4c0e7d3
commit
c0085a8f30
4 changed files with 77 additions and 68 deletions
|
|
@ -22,25 +22,16 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
#include "reduce.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <cassert>
|
||||
|
||||
#include "lunabbrev.hh"
|
||||
#include "simpfg.hh"
|
||||
#include "simplify.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
formula*
|
||||
reduce(const formula* f, int opt)
|
||||
{
|
||||
formula* f1;
|
||||
formula* f2;
|
||||
formula* prev = 0;
|
||||
|
||||
ltl_simplifier_options o;
|
||||
o.reduce_basics = opt & Reduce_Basics;
|
||||
o.synt_impl = opt & Reduce_Syntactic_Implications;
|
||||
|
|
@ -48,31 +39,7 @@ namespace spot
|
|||
o.containment_checks = opt & Reduce_Containment_Checks;
|
||||
o.containment_checks_stronger = opt & Reduce_Containment_Checks_Stronger;
|
||||
ltl_simplifier simplifier(o);
|
||||
|
||||
int n = 0;
|
||||
|
||||
while (f != prev)
|
||||
{
|
||||
++n;
|
||||
assert(n < 100);
|
||||
if (prev)
|
||||
{
|
||||
prev->destroy();
|
||||
prev = const_cast<formula*>(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = f->clone();
|
||||
}
|
||||
f1 = unabbreviate_logic(f);
|
||||
f2 = simplify_f_g(f1);
|
||||
f1->destroy();
|
||||
f = simplifier.simplify(f2);
|
||||
f2->destroy();
|
||||
}
|
||||
prev->destroy();
|
||||
|
||||
return const_cast<formula*>(f);
|
||||
return const_cast<formula*>(simplifier.simplify(f));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue