revamp the formula hierarchy (montro-patch)
Flatten the formula ltl::formula hiearchy into a single ltl::vnode that has an enumerator to distinguish the types of node, and a common interface to access children, update reference counts, etc. The ltl::formula class is now a thin wrapper around an ltl::vnode pointer to keep track of reference counts automatically. Visitor are not used anymore; we now have map() and traversor() methods that are more concise. This basically fixes #43, but should be followed by some fine tuning that should now be localized to the formula.hh and formula.cc files. Some statistics about this patch. I started working on it on Sep 9, had a first compiling version two weeks later on Sep 22, and it then took 5 days to fixes the ~70 distincts bugs that were introduced during the conversion. About 13200 lines were modified, and one third of those were removed. * src/ltlast/formula.cc, src/ltlast/formula.hh: Complete rewrite, including what was in separate nearby files. * src/ltlast/allnodes.hh, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlast/predecl.hh: Delete these files. Their feature have been merged in formula.hh and formula.cc. * src/ltlast/visitor.hh, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/dump.hh, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh: Delete these files, as we do not use visitors anymore. * bench/stutter/stutter_invariance_formulas.cc, bench/stutter/stutter_invariance_randomgraph.cc, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut10.org, doc/org/tut22.org, iface/ltsmin/ltsmin.cc, iface/ltsmin/ltsmin.hh, iface/ltsmin/modelcheck.cc, src/bin/autfilt.cc, src/bin/common_aoutput.cc, src/bin/common_aoutput.hh, src/bin/common_finput.cc, src/bin/common_finput.hh, src/bin/common_output.cc, src/bin/common_output.hh, src/bin/common_trans.cc, src/bin/common_trans.hh, src/bin/dstar2tgba.cc, src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc, src/bin/ltlgrind.cc, src/bin/randaut.cc, src/bin/randltl.cc, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/kripkeparse/kripkeparse.yy, src/ltlast/Makefile.am, src/ltlenv/declenv.cc, src/ltlenv/declenv.hh, src/ltlenv/defaultenv.cc, src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh, src/ltlparse/ltlparse.yy, src/ltlparse/public.hh, src/ltlvisit/Makefile.am, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/ltlvisit/dot.cc, src/ltlvisit/dot.hh, src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh, src/ltlvisit/length.cc, src/ltlvisit/length.hh, src/ltlvisit/mark.cc, src/ltlvisit/mark.hh, src/ltlvisit/mutation.cc, src/ltlvisit/mutation.hh, src/ltlvisit/nenoform.cc, src/ltlvisit/nenoform.hh, src/ltlvisit/print.cc, src/ltlvisit/print.hh, src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh, src/ltlvisit/relabel.cc, src/ltlvisit/relabel.hh, src/ltlvisit/remove_x.cc, src/ltlvisit/remove_x.hh, src/ltlvisit/simpfg.cc, src/ltlvisit/simpfg.hh, src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh, src/ltlvisit/snf.cc, src/ltlvisit/snf.hh, src/ltlvisit/unabbrev.cc, src/ltlvisit/unabbrev.hh, src/parseaut/parseaut.yy, src/ta/taexplicit.cc, src/ta/tgtaexplicit.cc, src/taalgos/minimize.cc, src/taalgos/tgba2ta.cc, src/tests/bare.test, src/tests/checkpsl.cc, src/tests/checkta.cc, src/tests/complementation.cc, src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc, src/tests/ikwiad.cc, src/tests/isop.test, src/tests/kind.cc, src/tests/length.cc, src/tests/ltldo.test, src/tests/ltlfilt.test, src/tests/ltlgrind.test, src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/parse_print_test.cc, src/tests/parseaut.test, src/tests/parseerr.test, src/tests/randtgba.cc, src/tests/readltl.cc, src/tests/reduc.cc, src/tests/syntimpl.cc, src/tests/taatgba.cc, src/tests/tostring.cc, src/tests/twagraph.cc, src/tests/utf8.test, src/twa/acc.cc, src/twa/bdddict.cc, src/twa/bdddict.hh, src/twa/bddprint.cc, src/twa/formula2bdd.cc, src/twa/formula2bdd.hh, src/twa/taatgba.cc, src/twa/taatgba.hh, src/twa/twa.cc, src/twa/twa.hh src/twa/twagraph.cc, src/twa/twagraph.hh, src/twa/twasafracomplement.cc, src/twaalgos/compsusp.cc, src/twaalgos/compsusp.hh, src/twaalgos/dtgbasat.cc, src/twaalgos/hoa.cc, src/twaalgos/lbtt.cc, src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2taa.hh, src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/ltl2tgba_fm.hh, src/twaalgos/minimize.cc, src/twaalgos/minimize.hh, src/twaalgos/neverclaim.cc, src/twaalgos/postproc.cc, src/twaalgos/postproc.hh, src/twaalgos/powerset.cc, src/twaalgos/powerset.hh, src/twaalgos/randomgraph.cc, src/twaalgos/remprop.cc, src/twaalgos/remprop.hh, src/twaalgos/stats.cc, src/twaalgos/stats.hh, src/twaalgos/stutter.cc, src/twaalgos/stutter.hh, src/twaalgos/translate.cc, src/twaalgos/translate.hh, wrap/python/ajax/spotcgi.in, wrap/python/spot.py, wrap/python/spot_impl.i, wrap/python/Makefile.am, wrap/python/tests/automata-io.ipynb, wrap/python/tests/formulas.ipynb, wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py, wrap/python/tests/ltlsimple.py, wrap/python/tests/randltl.ipynb: Adjust to use the new interface. * src/sanity/style.test: Accept more C++11 patterns. * NEWS: Mention the change.
This commit is contained in:
parent
1628b188fe
commit
b77f7e24c3
177 changed files with 8295 additions and 13332 deletions
|
|
@ -487,7 +487,7 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula*, const char*, int)
|
||||
process_formula(spot::ltl::formula, const char*, int)
|
||||
{
|
||||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ automaton_printer::automaton_printer(stat_style input)
|
|||
|
||||
void
|
||||
automaton_printer::print(const spot::twa_graph_ptr& aut,
|
||||
const spot::ltl::formula* f,
|
||||
spot::ltl::formula f,
|
||||
// Input location for errors and statistics.
|
||||
const char* filename,
|
||||
int loc,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public:
|
|||
std::ostream&
|
||||
print(const spot::const_parsed_aut_ptr& haut,
|
||||
const spot::const_twa_graph_ptr& aut,
|
||||
const spot::ltl::formula* f,
|
||||
spot::ltl::formula f,
|
||||
const char* filename, int loc, double run_time)
|
||||
{
|
||||
filename_ = filename ? filename : "";
|
||||
|
|
@ -225,7 +225,7 @@ public:
|
|||
|
||||
void
|
||||
print(const spot::twa_graph_ptr& aut,
|
||||
const spot::ltl::formula* f = nullptr,
|
||||
spot::ltl::formula f = nullptr,
|
||||
// Input location for errors and statistics.
|
||||
const char* filename = nullptr,
|
||||
int loc = -1,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ parse_opt_finput(int key, char* arg, struct argp_state*)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const spot::ltl::formula*
|
||||
spot::ltl::formula
|
||||
parse_formula(const std::string& s, spot::ltl::parse_error_list& pel)
|
||||
{
|
||||
if (lbt_input)
|
||||
|
|
@ -108,15 +108,13 @@ job_processor::process_string(const std::string& input,
|
|||
int linenum)
|
||||
{
|
||||
spot::ltl::parse_error_list pel;
|
||||
const spot::ltl::formula* f = parse_formula(input, pel);
|
||||
auto f = parse_formula(input, pel);
|
||||
|
||||
if (!f || !pel.empty())
|
||||
{
|
||||
if (filename)
|
||||
error_at_line(0, 0, filename, linenum, "parse error:");
|
||||
spot::ltl::format_parse_errors(std::cerr, input, pel);
|
||||
if (f)
|
||||
f->destroy();
|
||||
return 1;
|
||||
}
|
||||
return process_formula(f, filename, linenum);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2012, 2013, 2015 Laboratoire de Recherche et
|
||||
// Développement de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -44,7 +44,7 @@ extern const struct argp finput_argp;
|
|||
|
||||
int parse_opt_finput(int key, char* arg, struct argp_state* state);
|
||||
|
||||
const spot::ltl::formula*
|
||||
spot::ltl::formula
|
||||
parse_formula(const std::string& s, spot::ltl::parse_error_list& error_list);
|
||||
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual ~job_processor();
|
||||
|
||||
virtual int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0) = 0;
|
||||
|
||||
virtual int
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const struct argp output_argp = { options, parse_opt_output, 0, 0, 0, 0, 0 };
|
|||
|
||||
static
|
||||
void
|
||||
report_not_ltl(const spot::ltl::formula* f,
|
||||
report_not_ltl(spot::ltl::formula f,
|
||||
const char* filename, int linenum, const char* syn)
|
||||
{
|
||||
std::string s = spot::ltl::str_psl(f);
|
||||
|
|
@ -82,12 +82,12 @@ report_not_ltl(const spot::ltl::formula* f,
|
|||
|
||||
std::ostream&
|
||||
stream_formula(std::ostream& out,
|
||||
const spot::ltl::formula* f, const char* filename, int linenum)
|
||||
spot::ltl::formula f, const char* filename, int linenum)
|
||||
{
|
||||
switch (output_format)
|
||||
{
|
||||
case lbt_output:
|
||||
if (f->is_ltl_formula())
|
||||
if (f.is_ltl_formula())
|
||||
spot::ltl::print_lbt_ltl(out, f);
|
||||
else
|
||||
report_not_ltl(f, filename, linenum, "LBT");
|
||||
|
|
@ -96,13 +96,13 @@ stream_formula(std::ostream& out,
|
|||
spot::ltl::print_psl(out, f, full_parenth);
|
||||
break;
|
||||
case spin_output:
|
||||
if (f->is_ltl_formula())
|
||||
if (f.is_ltl_formula())
|
||||
spot::ltl::print_spin_ltl(out, f, full_parenth);
|
||||
else
|
||||
report_not_ltl(f, filename, linenum, "Spin");
|
||||
break;
|
||||
case wring_output:
|
||||
if (f->is_ltl_formula())
|
||||
if (f.is_ltl_formula())
|
||||
spot::ltl::print_wring_ltl(out, f);
|
||||
else
|
||||
report_not_ltl(f, filename, linenum, "Wring");
|
||||
|
|
@ -122,7 +122,7 @@ stream_formula(std::ostream& out,
|
|||
|
||||
static void
|
||||
stream_escapable_formula(std::ostream& os,
|
||||
const spot::ltl::formula* f,
|
||||
spot::ltl::formula f,
|
||||
const char* filename, int linenum)
|
||||
{
|
||||
if (escape_csv)
|
||||
|
|
@ -144,7 +144,7 @@ namespace
|
|||
{
|
||||
struct formula_with_location
|
||||
{
|
||||
const spot::ltl::formula* f;
|
||||
spot::ltl::formula f;
|
||||
const char* filename;
|
||||
int line;
|
||||
const char* prefix;
|
||||
|
|
@ -258,7 +258,7 @@ parse_opt_output(int key, char* arg, struct argp_state*)
|
|||
|
||||
static void
|
||||
output_formula(std::ostream& out,
|
||||
const spot::ltl::formula* f,
|
||||
spot::ltl::formula f,
|
||||
const char* filename = nullptr, int linenum = 0,
|
||||
const char* prefix = nullptr, const char* suffix = nullptr)
|
||||
{
|
||||
|
|
@ -284,7 +284,7 @@ void
|
|||
}
|
||||
|
||||
void
|
||||
output_formula_checked(const spot::ltl::formula* f,
|
||||
output_formula_checked(spot::ltl::formula f,
|
||||
const char* filename, int linenum,
|
||||
const char* prefix, const char* suffix)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,19 +43,19 @@ int parse_opt_output(int key, char* arg, struct argp_state* state);
|
|||
// Low-level output
|
||||
std::ostream&
|
||||
stream_formula(std::ostream& out,
|
||||
const spot::ltl::formula* f, const char* filename, int linenum);
|
||||
spot::ltl::formula f, const char* filename, int linenum);
|
||||
|
||||
void output_formula_checked(const spot::ltl::formula* f,
|
||||
void output_formula_checked(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0,
|
||||
const char* prefix = 0, const char* suffix = 0);
|
||||
|
||||
|
||||
class printable_formula:
|
||||
public spot::printable_value<const spot::ltl::formula*>
|
||||
public spot::printable_value<spot::ltl::formula>
|
||||
{
|
||||
public:
|
||||
printable_formula&
|
||||
operator=(const spot::ltl::formula* new_val)
|
||||
operator=(spot::ltl::formula new_val)
|
||||
{
|
||||
val_ = new_val;
|
||||
return *this;
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
std::ostream&
|
||||
print(const spot::const_twa_graph_ptr& aut,
|
||||
const spot::ltl::formula* f = 0,
|
||||
spot::ltl::formula f = 0,
|
||||
double run_time = -1.)
|
||||
{
|
||||
formula_ = f;
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ translator_runner::formula() const
|
|||
}
|
||||
|
||||
void
|
||||
translator_runner::round_formula(const spot::ltl::formula* f, unsigned serial)
|
||||
translator_runner::round_formula(spot::ltl::formula f, unsigned serial)
|
||||
{
|
||||
if (has('f') || has('F'))
|
||||
string_ltl_spot = spot::ltl::str_psl(f, true);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
bool no_output_allowed = false);
|
||||
void string_to_tmp(std::string& str, unsigned n, std::string& tmpname);
|
||||
const std::string& formula() const;
|
||||
void round_formula(const spot::ltl::formula* f, unsigned serial);
|
||||
void round_formula(spot::ltl::formula f, unsigned serial);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula*, const char*, int)
|
||||
process_formula(spot::ltl::formula, const char*, int)
|
||||
{
|
||||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@
|
|||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlenv/defaultenv.hh"
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlvisit/relabel.hh"
|
||||
|
||||
using namespace spot;
|
||||
|
|
@ -270,37 +269,31 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
return 0;
|
||||
}
|
||||
|
||||
environment& env(default_environment::instance());
|
||||
#define G_(x) formula::G(x)
|
||||
#define F_(x) formula::F(x)
|
||||
#define X_(x) formula::X(x)
|
||||
#define Not_(x) formula::Not(x)
|
||||
|
||||
#define G_(x) spot::ltl::unop::instance(spot::ltl::unop::G, (x))
|
||||
#define F_(x) spot::ltl::unop::instance(spot::ltl::unop::F, (x))
|
||||
#define X_(x) spot::ltl::unop::instance(spot::ltl::unop::X, (x))
|
||||
#define Not_(x) spot::ltl::unop::instance(spot::ltl::unop::Not, (x))
|
||||
#define Implies_(x, y) \
|
||||
spot::ltl::binop::instance(spot::ltl::binop::Implies, (x), (y))
|
||||
#define Equiv_(x, y) \
|
||||
spot::ltl::binop::instance(spot::ltl::binop::Equiv, (x), (y))
|
||||
#define And_(x, y) \
|
||||
spot::ltl::multop::instance(spot::ltl::multop::And, (x), (y))
|
||||
#define Or_(x, y) \
|
||||
spot::ltl::multop::instance(spot::ltl::multop::Or, (x), (y))
|
||||
#define U_(x, y) \
|
||||
spot::ltl::binop::instance(spot::ltl::binop::U, (x), (y))
|
||||
#define Implies_(x, y) formula::Implies((x), (y))
|
||||
#define Equiv_(x, y) formula::Equiv((x), (y))
|
||||
#define And_(x, y) formula::And({(x), (y)})
|
||||
#define Or_(x, y) formula::Or({(x), (y)})
|
||||
#define U_(x, y) formula::U((x), (y))
|
||||
|
||||
// F(p_1 & F(p_2 & F(p_3 & ... F(p_n))))
|
||||
static const formula*
|
||||
static formula
|
||||
E_n(std::string name, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return constant::true_instance();
|
||||
return formula::tt();
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
for (; n > 0; --n)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << n;
|
||||
const formula* f = env.require(p.str());
|
||||
formula f = formula::ap(p.str());
|
||||
if (result)
|
||||
result = And_(f, result);
|
||||
else
|
||||
|
|
@ -311,43 +304,43 @@ E_n(std::string name, int n)
|
|||
}
|
||||
|
||||
// p & X(p & X(p & ... X(p)))
|
||||
static const formula*
|
||||
static formula
|
||||
phi_n(std::string name, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return constant::true_instance();
|
||||
return formula::tt();
|
||||
|
||||
const formula* result = 0;
|
||||
const formula* p = env.require(name);
|
||||
formula result = nullptr;
|
||||
formula p = formula::ap(name);
|
||||
for (; n > 0; --n)
|
||||
{
|
||||
if (result)
|
||||
result = And_(p->clone(), X_(result));
|
||||
result = And_(p, X_(result));
|
||||
else
|
||||
result = p;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const formula* N_n(std::string name, int n)
|
||||
formula N_n(std::string name, int n)
|
||||
{
|
||||
return unop::instance(unop::F, phi_n(name, n));
|
||||
return formula::F(phi_n(name, n));
|
||||
}
|
||||
|
||||
// p & X(p) & XX(p) & XXX(p) & ... X^n(p)
|
||||
static const formula*
|
||||
static formula
|
||||
phi_prime_n(std::string name, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return constant::true_instance();
|
||||
return formula::tt();
|
||||
|
||||
const formula* result = 0;
|
||||
const formula* p = env.require(name);
|
||||
formula result = nullptr;
|
||||
formula p = formula::ap(name);
|
||||
for (; n > 0; --n)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
p = X_(p->clone());
|
||||
p = X_(p);
|
||||
result = And_(result, p);
|
||||
}
|
||||
else
|
||||
|
|
@ -358,7 +351,7 @@ phi_prime_n(std::string name, int n)
|
|||
return result;
|
||||
}
|
||||
|
||||
static const formula*
|
||||
static formula
|
||||
N_prime_n(std::string name, int n)
|
||||
{
|
||||
return F_(phi_prime_n(name, n));
|
||||
|
|
@ -367,24 +360,24 @@ N_prime_n(std::string name, int n)
|
|||
|
||||
// GF(p_1) & GF(p_2) & ... & GF(p_n) if conj == true
|
||||
// GF(p_1) | GF(p_2) | ... | GF(p_n) if conj == false
|
||||
static const formula*
|
||||
static formula
|
||||
GF_n(std::string name, int n, bool conj = true)
|
||||
{
|
||||
if (n <= 0)
|
||||
return conj ? constant::true_instance() : constant::false_instance();
|
||||
return conj ? formula::tt() : formula::ff();
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
multop::type op = conj ? multop::And : multop::Or;
|
||||
op o = conj ? op::And : op::Or;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << i;
|
||||
const formula* f = G_(F_(env.require(p.str())));
|
||||
formula f = G_(F_(formula::ap(p.str())));
|
||||
|
||||
if (result)
|
||||
result = multop::instance(op, f, result);
|
||||
result = formula::multop(o, {f, result});
|
||||
else
|
||||
result = f;
|
||||
}
|
||||
|
|
@ -393,24 +386,24 @@ GF_n(std::string name, int n, bool conj = true)
|
|||
|
||||
// FG(p_1) | FG(p_2) | ... | FG(p_n) if conj == false
|
||||
// FG(p_1) & FG(p_2) & ... & FG(p_n) if conj == true
|
||||
static const formula*
|
||||
static formula
|
||||
FG_n(std::string name, int n, bool conj = false)
|
||||
{
|
||||
if (n <= 0)
|
||||
return conj ? constant::true_instance() : constant::false_instance();
|
||||
return conj ? formula::tt() : formula::ff();
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
multop::type op = conj ? multop::And : multop::Or;
|
||||
op o = conj ? op::And : op::Or;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << i;
|
||||
const formula* f = F_(G_(env.require(p.str())));
|
||||
formula f = F_(G_(formula::ap(p.str())));
|
||||
|
||||
if (result)
|
||||
result = multop::instance(op, f, result);
|
||||
result = formula::multop(o, {f, result});
|
||||
else
|
||||
result = f;
|
||||
}
|
||||
|
|
@ -419,93 +412,91 @@ FG_n(std::string name, int n, bool conj = false)
|
|||
|
||||
// (((p1 OP p2) OP p3)...OP pn) if right_assoc == false
|
||||
// (p1 OP (p2 OP (p3 OP (... pn) if right_assoc == true
|
||||
static const formula*
|
||||
bin_n(std::string name, int n,
|
||||
binop::type op, bool right_assoc = false)
|
||||
static formula
|
||||
bin_n(std::string name, int n, op o, bool right_assoc = false)
|
||||
{
|
||||
if (n <= 0)
|
||||
n = 1;
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << (right_assoc ? (n + 1 - i) : i);
|
||||
const formula* f = env.require(p.str());
|
||||
formula f = formula::ap(p.str());
|
||||
if (!result)
|
||||
result = f;
|
||||
else if (right_assoc)
|
||||
result = binop::instance(op, f, result);
|
||||
result = formula::binop(o, f, result);
|
||||
else
|
||||
result = binop::instance(op, result, f);
|
||||
result = formula::binop(o, result, f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// (GF(p1)|FG(p2))&(GF(p2)|FG(p3))&...&(GF(pn)|FG(p{n+1}))"
|
||||
static const formula*
|
||||
static formula
|
||||
R_n(std::string name, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return constant::true_instance();
|
||||
return formula::tt();
|
||||
|
||||
const formula* pi;
|
||||
formula pi;
|
||||
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << 1;
|
||||
pi = env.require(p.str());
|
||||
pi = formula::ap(p.str());
|
||||
}
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
const formula* gf = G_(F_(pi));
|
||||
formula gf = G_(F_(pi));
|
||||
std::ostringstream p;
|
||||
p << name << i + 1;
|
||||
pi = env.require(p.str());
|
||||
pi = formula::ap(p.str());
|
||||
|
||||
const formula* fg = F_(G_(pi->clone()));
|
||||
formula fg = F_(G_(pi));
|
||||
|
||||
const formula* f = Or_(gf, fg);
|
||||
formula f = Or_(gf, fg);
|
||||
|
||||
if (result)
|
||||
result = And_(f, result);
|
||||
else
|
||||
result = f;
|
||||
}
|
||||
pi->destroy();
|
||||
return result;
|
||||
}
|
||||
|
||||
// (F(p1)|G(p2))&(F(p2)|G(p3))&...&(F(pn)|G(p{n+1}))"
|
||||
static const formula*
|
||||
static formula
|
||||
Q_n(std::string name, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return constant::true_instance();
|
||||
return formula::tt();
|
||||
|
||||
const formula* pi;
|
||||
formula pi;
|
||||
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << 1;
|
||||
pi = env.require(p.str());
|
||||
pi = formula::ap(p.str());
|
||||
}
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
const formula* f = F_(pi);
|
||||
formula f = F_(pi);
|
||||
|
||||
std::ostringstream p;
|
||||
p << name << i + 1;
|
||||
pi = env.require(p.str());
|
||||
pi = formula::ap(p.str());
|
||||
|
||||
const formula* g = G_(pi->clone());
|
||||
formula g = G_(pi);
|
||||
|
||||
f = Or_(f, g);
|
||||
|
||||
|
|
@ -514,31 +505,29 @@ Q_n(std::string name, int n)
|
|||
else
|
||||
result = f;
|
||||
}
|
||||
pi->destroy();
|
||||
return result;
|
||||
}
|
||||
|
||||
// OP(p1) | OP(p2) | ... | OP(Pn) if conj == false
|
||||
// OP(p1) & OP(p2) & ... & OP(Pn) if conj == true
|
||||
static const formula*
|
||||
combunop_n(std::string name, int n,
|
||||
unop::type op, bool conj = false)
|
||||
static formula
|
||||
combunop_n(std::string name, int n, op o, bool conj = false)
|
||||
{
|
||||
if (n <= 0)
|
||||
return conj ? constant::true_instance() : constant::false_instance();
|
||||
return conj ? formula::tt() : formula::ff();
|
||||
|
||||
const formula* result = 0;
|
||||
formula result = nullptr;
|
||||
|
||||
multop::type cop = conj ? multop::And : multop::Or;
|
||||
op cop = conj ? op::And : op::Or;
|
||||
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << name << i;
|
||||
const formula* f = unop::instance(op, env.require(p.str()));
|
||||
formula f = formula::unop(o, formula::ap(p.str()));
|
||||
|
||||
if (result)
|
||||
result = multop::instance(cop, f, result);
|
||||
result = formula::multop(cop, {f, result});
|
||||
else
|
||||
result = f;
|
||||
}
|
||||
|
|
@ -547,21 +536,21 @@ combunop_n(std::string name, int n,
|
|||
|
||||
// !((GF(p1)&GF(p2)&...&GF(pn))->G(q -> F(r)))
|
||||
// From "Fast LTL to Büchi Automata Translation" [gastin.01.cav]
|
||||
static const formula*
|
||||
static formula
|
||||
fair_response(std::string p, std::string q, std::string r, int n)
|
||||
{
|
||||
const formula* fair = GF_n(p, n);
|
||||
const formula* resp = G_(Implies_(env.require(q), F_(env.require(r))));
|
||||
formula fair = GF_n(p, n);
|
||||
formula resp = G_(Implies_(formula::ap(q), F_(formula::ap(r))));
|
||||
return Not_(Implies_(fair, resp));
|
||||
}
|
||||
|
||||
|
||||
// Builds X(X(...X(p))) with n occurrences of X.
|
||||
static const formula*
|
||||
X_n(const formula* p, int n)
|
||||
static formula
|
||||
X_n(formula p, int n)
|
||||
{
|
||||
assert(n >= 0);
|
||||
const formula* res = p;
|
||||
formula res = p;
|
||||
while (n--)
|
||||
res = X_(res);
|
||||
return res;
|
||||
|
|
@ -569,214 +558,174 @@ X_n(const formula* p, int n)
|
|||
|
||||
// Based on LTLcounter.pl from Kristin Rozier.
|
||||
// http://shemesh.larc.nasa.gov/people/kyr/benchmarking_scripts/
|
||||
static const formula*
|
||||
static formula
|
||||
ltl_counter(std::string bit, std::string marker, int n, bool linear)
|
||||
{
|
||||
const formula* b = env.require(bit);
|
||||
const formula* neg_b = Not_(b);
|
||||
const formula* m = env.require(marker);
|
||||
const formula* neg_m = Not_(m); // to destroy
|
||||
formula b = formula::ap(bit);
|
||||
formula neg_b = Not_(b);
|
||||
formula m = formula::ap(marker);
|
||||
formula neg_m = Not_(m);
|
||||
|
||||
multop::vec* res = new multop::vec(4);
|
||||
std::vector<formula> res(4);
|
||||
|
||||
// The marker starts with "1", followed by n-1 "0", then "1" again,
|
||||
// n-1 "0", etc.
|
||||
if (!linear)
|
||||
{
|
||||
// G(m -> X(!m)&XX(!m)&XXX(m)) [if n = 3]
|
||||
multop::vec* v = new multop::vec(n);
|
||||
std::vector<formula> v(n);
|
||||
for (int i = 0; i + 1 < n; ++i)
|
||||
(*v)[i] = X_n(neg_m->clone(), i + 1);
|
||||
(*v)[n - 1] = X_n(m->clone(), n);
|
||||
(*res)[0] = And_(m->clone(),
|
||||
G_(Implies_(m->clone(),
|
||||
multop::instance(multop::And, v))));
|
||||
v[i] = X_n(neg_m, i + 1);
|
||||
v[n - 1] = X_n(m, n);
|
||||
res[0] = And_(m, G_(Implies_(m, formula::And(std::move(v)))));
|
||||
}
|
||||
else
|
||||
{
|
||||
// G(m -> X(!m & X(!m X(m)))) [if n = 3]
|
||||
const formula* p = m->clone();
|
||||
formula p = m;
|
||||
for (int i = n - 1; i > 0; --i)
|
||||
p = And_(neg_m->clone(), X_(p));
|
||||
(*res)[0] = And_(m->clone(),
|
||||
G_(Implies_(m->clone(), X_(p))));
|
||||
p = And_(neg_m, X_(p));
|
||||
res[0] = And_(m, G_(Implies_(m, X_(p))));
|
||||
}
|
||||
|
||||
// All bits are initially zero.
|
||||
if (!linear)
|
||||
{
|
||||
// !b & X(!b) & XX(!b) [if n = 3]
|
||||
multop::vec* v2 = new multop::vec(n);
|
||||
std::vector<formula> v2(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
(*v2)[i] = X_n(neg_b->clone(), i);
|
||||
(*res)[1] = multop::instance(multop::And, v2);
|
||||
v2[i] = X_n(neg_b, i);
|
||||
res[1] = formula::And(std::move(v2));
|
||||
}
|
||||
else
|
||||
{
|
||||
// !b & X(!b & X(!b)) [if n = 3]
|
||||
const formula* p = neg_b->clone();
|
||||
formula p = neg_b;
|
||||
for (int i = n - 1; i > 0; --i)
|
||||
p = And_(neg_b->clone(), X_(p));
|
||||
(*res)[1] = p;
|
||||
p = And_(neg_b, X_(p));
|
||||
res[1] = p;
|
||||
}
|
||||
|
||||
#define AndX_(x, y) (linear ? X_(And_((x), (y))) : And_(X_(x), X_(y)))
|
||||
|
||||
// If the least significant bit is 0, it will be 1 at the next time,
|
||||
// and other bits stay the same.
|
||||
const formula* Xnm1_b = X_n(b->clone(), n - 1);
|
||||
const formula* Xn_b = X_(Xnm1_b); // to destroy
|
||||
(*res)[2] =
|
||||
G_(Implies_(And_(m->clone(), neg_b->clone()),
|
||||
AndX_(Xnm1_b->clone(), U_(And_(Not_(m->clone()),
|
||||
Equiv_(b->clone(),
|
||||
Xn_b->clone())),
|
||||
m->clone()))));
|
||||
formula Xnm1_b = X_n(b, n - 1);
|
||||
formula Xn_b = X_(Xnm1_b);
|
||||
res[2] = G_(Implies_(And_(m, neg_b),
|
||||
AndX_(Xnm1_b, U_(And_(Not_(m), Equiv_(b, Xn_b)), m))));
|
||||
|
||||
// From the least significant bit to the first 0, all the bits
|
||||
// are flipped on the next value. Remaining bits are identical.
|
||||
const formula* Xnm1_negb = X_n(neg_b, n - 1);
|
||||
const formula* Xn_negb = X_(Xnm1_negb); // to destroy
|
||||
(*res)[3] =
|
||||
G_(Implies_(And_(m->clone(), b->clone()),
|
||||
AndX_(Xnm1_negb->clone(),
|
||||
U_(And_(And_(b->clone(), neg_m->clone()),
|
||||
Xn_negb->clone()),
|
||||
Or_(m->clone(),
|
||||
And_(And_(neg_m->clone(),
|
||||
neg_b->clone()),
|
||||
AndX_(Xnm1_b->clone(),
|
||||
U_(And_(neg_m->clone(),
|
||||
Equiv_(b->clone(),
|
||||
Xn_b->clone())),
|
||||
m->clone()))))))));
|
||||
neg_m->destroy();
|
||||
Xn_b->destroy();
|
||||
Xn_negb->destroy();
|
||||
|
||||
return multop::instance(multop::And, res);
|
||||
formula Xnm1_negb = X_n(neg_b, n - 1);
|
||||
formula Xn_negb = X_(Xnm1_negb);
|
||||
res[3] = G_(Implies_(And_(m, b),
|
||||
AndX_(Xnm1_negb,
|
||||
U_(And_(And_(b, neg_m), Xn_negb),
|
||||
Or_(m, And_(And_(neg_m, neg_b),
|
||||
AndX_(Xnm1_b,
|
||||
U_(And_(neg_m,
|
||||
Equiv_(b, Xn_b)),
|
||||
m))))))));
|
||||
return formula::And(std::move(res));
|
||||
}
|
||||
|
||||
static const formula*
|
||||
static formula
|
||||
ltl_counter_carry(std::string bit, std::string marker,
|
||||
std::string carry, int n, bool linear)
|
||||
{
|
||||
const formula* b = env.require(bit);
|
||||
const formula* neg_b = Not_(b);
|
||||
const formula* m = env.require(marker);
|
||||
const formula* neg_m = Not_(m); // to destroy
|
||||
const formula* c = env.require(carry);
|
||||
const formula* neg_c = Not_(c); // to destroy
|
||||
formula b = formula::ap(bit);
|
||||
formula neg_b = Not_(b);
|
||||
formula m = formula::ap(marker);
|
||||
formula neg_m = Not_(m);
|
||||
formula c = formula::ap(carry);
|
||||
formula neg_c = Not_(c);
|
||||
|
||||
multop::vec* res = new multop::vec(6);
|
||||
std::vector<formula> res(6);
|
||||
|
||||
// The marker starts with "1", followed by n-1 "0", then "1" again,
|
||||
// n-1 "0", etc.
|
||||
if (!linear)
|
||||
{
|
||||
// G(m -> X(!m)&XX(!m)&XXX(m)) [if n = 3]
|
||||
multop::vec* v = new multop::vec(n);
|
||||
std::vector<formula> v(n);
|
||||
for (int i = 0; i + 1 < n; ++i)
|
||||
(*v)[i] = X_n(neg_m->clone(), i + 1);
|
||||
(*v)[n - 1] = X_n(m->clone(), n);
|
||||
(*res)[0] = And_(m->clone(),
|
||||
G_(Implies_(m->clone(),
|
||||
multop::instance(multop::And, v))));
|
||||
v[i] = X_n(neg_m, i + 1);
|
||||
v[n - 1] = X_n(m, n);
|
||||
res[0] = And_(m, G_(Implies_(m, formula::And(std::move(v)))));
|
||||
}
|
||||
else
|
||||
{
|
||||
// G(m -> X(!m & X(!m X(m)))) [if n = 3]
|
||||
const formula* p = m->clone();
|
||||
formula p = m;
|
||||
for (int i = n - 1; i > 0; --i)
|
||||
p = And_(neg_m->clone(), X_(p));
|
||||
(*res)[0] = And_(m->clone(),
|
||||
G_(Implies_(m->clone(), X_(p))));
|
||||
p = And_(neg_m, X_(p));
|
||||
res[0] = And_(m, G_(Implies_(m, X_(p))));
|
||||
}
|
||||
|
||||
// All bits are initially zero.
|
||||
if (!linear)
|
||||
{
|
||||
// !b & X(!b) & XX(!b) [if n = 3]
|
||||
multop::vec* v2 = new multop::vec(n);
|
||||
std::vector<formula> v2(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
(*v2)[i] = X_n(neg_b->clone(), i);
|
||||
(*res)[1] = multop::instance(multop::And, v2);
|
||||
v2[i] = X_n(neg_b, i);
|
||||
res[1] = formula::And(std::move(v2));
|
||||
}
|
||||
else
|
||||
{
|
||||
// !b & X(!b & X(!b)) [if n = 3]
|
||||
const formula* p = neg_b->clone();
|
||||
formula p = neg_b;
|
||||
for (int i = n - 1; i > 0; --i)
|
||||
p = And_(neg_b->clone(), X_(p));
|
||||
(*res)[1] = p;
|
||||
p = And_(neg_b, X_(p));
|
||||
res[1] = p;
|
||||
}
|
||||
|
||||
const formula* Xn_b = X_n(b->clone(), n); // to destroy
|
||||
const formula* Xn_negb = X_n(neg_b, n); // to destroy
|
||||
formula Xn_b = X_n(b, n);
|
||||
formula Xn_negb = X_n(neg_b, n);
|
||||
|
||||
// If m is 1 and b is 0 then c is 0 and n steps later b is 1.
|
||||
(*res)[2] = G_(Implies_(And_(m->clone(), neg_b->clone()),
|
||||
And_(neg_c->clone(), Xn_b->clone())));
|
||||
res[2] = G_(Implies_(And_(m, neg_b), And_(neg_c, Xn_b)));
|
||||
|
||||
// If m is 1 and b is 1 then c is 1 and n steps later b is 0.
|
||||
(*res)[3] = G_(Implies_(And_(m->clone(), b->clone()),
|
||||
And_(c->clone(), Xn_negb->clone())));
|
||||
res[3] = G_(Implies_(And_(m, b), And_(c, Xn_negb)));
|
||||
|
||||
if (!linear)
|
||||
{
|
||||
// If there's no carry, then all of the bits stay the same n steps later.
|
||||
(*res)[4] = G_(Implies_(And_(neg_c->clone(), X_(neg_m->clone())),
|
||||
And_(X_(Not_(c->clone())),
|
||||
Equiv_(X_(b->clone()),
|
||||
X_(Xn_b->clone())))));
|
||||
res[4] = G_(Implies_(And_(neg_c, X_(neg_m)),
|
||||
And_(X_(Not_(c)), Equiv_(X_(b), X_(Xn_b)))));
|
||||
|
||||
// If there's a carry, then add one: flip the bits of b and
|
||||
// adjust the carry.
|
||||
(*res)[5] = G_(Implies_(c->clone(),
|
||||
And_(Implies_(X_(neg_b->clone()),
|
||||
And_(X_(neg_c->clone()),
|
||||
X_(Xn_b->clone()))),
|
||||
Implies_(X_(b->clone()),
|
||||
And_(X_(c->clone()),
|
||||
X_(Xn_negb->clone()))))));
|
||||
res[5] = G_(Implies_(c, And_(Implies_(X_(neg_b),
|
||||
And_(X_(neg_c), X_(Xn_b))),
|
||||
Implies_(X_(b),
|
||||
And_(X_(c), X_(Xn_negb))))));
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there's no carry, then all of the bits stay the same n steps later.
|
||||
(*res)[4] = G_(Implies_(And_(neg_c->clone(), X_(neg_m->clone())),
|
||||
X_(And_(Not_(c->clone()),
|
||||
Equiv_(b->clone(),
|
||||
Xn_b->clone())))));
|
||||
|
||||
res[4] = G_(Implies_(And_(neg_c, X_(neg_m)),
|
||||
X_(And_(Not_(c), Equiv_(b, Xn_b)))));
|
||||
// If there's a carry, then add one: flip the bits of b and
|
||||
// adjust the carry.
|
||||
(*res)[5] = G_(Implies_(c->clone(),
|
||||
X_(And_(Implies_(neg_b->clone(),
|
||||
And_(neg_c->clone(),
|
||||
Xn_b->clone())),
|
||||
Implies_(b->clone(),
|
||||
And_(c->clone(),
|
||||
Xn_negb->clone()))))));
|
||||
res[5] = G_(Implies_(c, X_(And_(Implies_(neg_b, And_(neg_c, Xn_b)),
|
||||
Implies_(b, And_(c, Xn_negb))))));
|
||||
}
|
||||
|
||||
neg_m->destroy();
|
||||
neg_c->destroy();
|
||||
Xn_b->destroy();
|
||||
Xn_negb->destroy();
|
||||
|
||||
return multop::instance(multop::And, res);
|
||||
return formula::And(std::move(res));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_pattern(int pattern, int n)
|
||||
{
|
||||
const formula* f = 0;
|
||||
formula f = nullptr;
|
||||
switch (pattern)
|
||||
{
|
||||
// Keep this alphabetically-ordered!
|
||||
case OPT_AND_F:
|
||||
f = combunop_n("p", n, unop::F, true);
|
||||
f = combunop_n("p", n, op::F, true);
|
||||
break;
|
||||
case OPT_AND_FG:
|
||||
f = FG_n("p", n, true);
|
||||
|
|
@ -785,13 +734,13 @@ output_pattern(int pattern, int n)
|
|||
f = GF_n("p", n, true);
|
||||
break;
|
||||
case OPT_CCJ_ALPHA:
|
||||
f = multop::instance(multop::And, E_n("p", n), E_n("q", n));
|
||||
f = formula::And({E_n("p", n), E_n("q", n)});
|
||||
break;
|
||||
case OPT_CCJ_BETA:
|
||||
f = multop::instance(multop::And, N_n("p", n), N_n("q", n));
|
||||
f = formula::And({N_n("p", n), N_n("q", n)});
|
||||
break;
|
||||
case OPT_CCJ_BETA_PRIME:
|
||||
f = multop::instance(multop::And, N_prime_n("p", n), N_prime_n("q", n));
|
||||
f = formula::And({N_prime_n("p", n), N_prime_n("q", n)});
|
||||
break;
|
||||
case OPT_GH_Q:
|
||||
f = Q_n("p", n);
|
||||
|
|
@ -806,16 +755,16 @@ output_pattern(int pattern, int n)
|
|||
f = FG_n("p", n, false);
|
||||
break;
|
||||
case OPT_OR_G:
|
||||
f = combunop_n("p", n, unop::G, false);
|
||||
f = combunop_n("p", n, op::G, false);
|
||||
break;
|
||||
case OPT_OR_GF:
|
||||
f = GF_n("p", n, false);
|
||||
break;
|
||||
case OPT_R_LEFT:
|
||||
f = bin_n("p", n, binop::R, false);
|
||||
f = bin_n("p", n, op::R, false);
|
||||
break;
|
||||
case OPT_R_RIGHT:
|
||||
f = bin_n("p", n, binop::R, true);
|
||||
f = bin_n("p", n, op::R, true);
|
||||
break;
|
||||
case OPT_RV_COUNTER_CARRY:
|
||||
f = ltl_counter_carry("b", "m", "c", n, false);
|
||||
|
|
@ -830,10 +779,10 @@ output_pattern(int pattern, int n)
|
|||
f = ltl_counter("b", "m", n, true);
|
||||
break;
|
||||
case OPT_U_LEFT:
|
||||
f = bin_n("p", n, binop::U, false);
|
||||
f = bin_n("p", n, op::U, false);
|
||||
break;
|
||||
case OPT_U_RIGHT:
|
||||
f = bin_n("p", n, binop::U, true);
|
||||
f = bin_n("p", n, op::U, true);
|
||||
break;
|
||||
default:
|
||||
error(100, 0, "internal error: pattern not implemented");
|
||||
|
|
@ -841,15 +790,10 @@ output_pattern(int pattern, int n)
|
|||
|
||||
// Make sure we use only "p42"-style of atomic propositions
|
||||
// in lbt's output.
|
||||
if (output_format == lbt_output && !f->has_lbt_atomic_props())
|
||||
{
|
||||
const spot::ltl::formula* r = spot::ltl::relabel(f, spot::ltl::Pnn);
|
||||
f->destroy();
|
||||
f = r;
|
||||
}
|
||||
if (output_format == lbt_output && !f.has_lbt_atomic_props())
|
||||
f = relabel(f, Pnn);
|
||||
|
||||
output_formula_checked(f, class_name[pattern - 1], n);
|
||||
f->destroy();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -138,14 +138,14 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
// This should not happen, because the parser we use can only
|
||||
// read PSL/LTL formula, but since our ltl::formula* type can
|
||||
// read PSL/LTL formula, but since our ltl::formula type can
|
||||
// represent more than PSL formula, let's make this
|
||||
// future-proof.
|
||||
if (!f->is_psl_formula())
|
||||
if (!f.is_psl_formula())
|
||||
{
|
||||
std::string s = spot::ltl::str_psl(f);
|
||||
error_at_line(2, 0, filename, linenum,
|
||||
|
|
@ -159,7 +159,6 @@ namespace
|
|||
const double translation_time = sw.stop();
|
||||
|
||||
printer.print(aut, f, filename, linenum, translation_time, nullptr);
|
||||
f->destroy();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -170,16 +170,16 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
auto aut = trans.run(&f);
|
||||
|
||||
// This should not happen, because the parser we use can only
|
||||
// read PSL/LTL formula, but since our ltl::formula* type can
|
||||
// read PSL/LTL formula, but since our ltl::formula type can
|
||||
// represent more than PSL formula, let's make this
|
||||
// future-proof.
|
||||
if (!f->is_psl_formula())
|
||||
if (!f.is_psl_formula())
|
||||
{
|
||||
std::string s = spot::ltl::str_psl(f);
|
||||
error_at_line(2, 0, filename, linenum,
|
||||
|
|
@ -207,7 +207,6 @@ namespace
|
|||
tgta = spot::minimize_tgta(tgta);
|
||||
spot::print_dot(std::cout, tgta->get_ta());
|
||||
}
|
||||
f->destroy();
|
||||
flush_cout();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include "common_file.hh"
|
||||
#include "common_finput.hh"
|
||||
#include "parseaut/public.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlvisit/mutation.hh"
|
||||
|
|
@ -819,8 +818,7 @@ namespace
|
|||
}
|
||||
|
||||
typedef
|
||||
std::unordered_set<const spot::ltl::formula*,
|
||||
const spot::ptr_hash<const spot::ltl::formula> > fset_t;
|
||||
std::unordered_set<spot::ltl::formula> fset_t;
|
||||
|
||||
|
||||
class processor: public job_processor
|
||||
|
|
@ -834,32 +832,22 @@ namespace
|
|||
{
|
||||
}
|
||||
|
||||
~processor()
|
||||
{
|
||||
fset_t::iterator i = unique_set.begin();
|
||||
while (i != unique_set.end())
|
||||
(*i++)->destroy();
|
||||
}
|
||||
|
||||
int
|
||||
process_string(const std::string& input,
|
||||
const char* filename,
|
||||
int linenum)
|
||||
{
|
||||
spot::ltl::parse_error_list pel;
|
||||
const spot::ltl::formula* f = parse_formula(input, pel);
|
||||
spot::ltl::formula f = parse_formula(input, pel);
|
||||
|
||||
if (!f || !pel.empty())
|
||||
{
|
||||
if (filename)
|
||||
error_at_line(0, 0, filename, linenum, "parse error:");
|
||||
spot::ltl::format_parse_errors(std::cerr, input, pel);
|
||||
if (f)
|
||||
f->destroy();
|
||||
return 1;
|
||||
}
|
||||
|
||||
f->clone();
|
||||
int res = process_formula(f, filename, linenum);
|
||||
|
||||
if (res && bogus_output)
|
||||
|
|
@ -867,7 +855,7 @@ namespace
|
|||
if (res && grind_output)
|
||||
{
|
||||
std::string bogus = input;
|
||||
std::vector<const spot::ltl::formula*> mutations;
|
||||
std::vector<spot::ltl::formula> mutations;
|
||||
unsigned mutation_count;
|
||||
unsigned mutation_max;
|
||||
while (res)
|
||||
|
|
@ -888,15 +876,12 @@ namespace
|
|||
{
|
||||
std::cerr << "Mutation " << mutation_count << '/'
|
||||
<< mutation_max << ": ";
|
||||
f->destroy();
|
||||
f = g->clone();
|
||||
res = process_formula(g->clone());
|
||||
f = g;
|
||||
res = process_formula(g);
|
||||
if (res)
|
||||
break;
|
||||
++mutation_count;
|
||||
}
|
||||
for (auto g: mutations)
|
||||
g->destroy();
|
||||
if (res)
|
||||
{
|
||||
if (lbt_input)
|
||||
|
|
@ -922,8 +907,6 @@ namespace
|
|||
std::cerr << ".\n\n";
|
||||
grind_output->ostream() << bogus << std::endl;
|
||||
}
|
||||
f->destroy();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -954,20 +937,16 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
static unsigned round = 0;
|
||||
|
||||
// If we need LBT atomic proposition in any of the input or
|
||||
// output, relabel the formula.
|
||||
if (!f->has_lbt_atomic_props() &&
|
||||
if (!f.has_lbt_atomic_props() &&
|
||||
(runner.has('l') || runner.has('L') || runner.has('T')))
|
||||
{
|
||||
const spot::ltl::formula* g = spot::ltl::relabel(f, spot::ltl::Pnn);
|
||||
f->destroy();
|
||||
f = g;
|
||||
}
|
||||
f = spot::ltl::relabel(f, spot::ltl::Pnn);
|
||||
|
||||
// ---------- Positive Formula ----------
|
||||
|
||||
|
|
@ -991,18 +970,13 @@ namespace
|
|||
// Make sure we do not translate the same formula twice.
|
||||
if (!allow_dups)
|
||||
{
|
||||
if (unique_set.insert(f).second)
|
||||
{
|
||||
f->clone();
|
||||
}
|
||||
else
|
||||
if (!unique_set.insert(f).second)
|
||||
{
|
||||
std::cerr
|
||||
<< ("warning: This formula or its negation has already"
|
||||
" been checked.\n Use --allow-dups if it "
|
||||
"should not be ignored.\n")
|
||||
<< std::endl;
|
||||
f->destroy();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1053,12 +1027,11 @@ namespace
|
|||
nstats = &vstats[n + 1];
|
||||
nstats->resize(m);
|
||||
|
||||
const spot::ltl::formula* nf =
|
||||
spot::ltl::unop::instance(spot::ltl::unop::Not, f->clone());
|
||||
spot::ltl::formula nf = spot::ltl::formula::Not(f);
|
||||
|
||||
if (!allow_dups)
|
||||
{
|
||||
bool res = unique_set.insert(nf->clone()).second;
|
||||
bool res = unique_set.insert(nf).second;
|
||||
// It is not possible to discover that nf has already been
|
||||
// translated, otherwise that would mean that f had been
|
||||
// translated too and we would have caught it before.
|
||||
|
|
@ -1084,7 +1057,6 @@ namespace
|
|||
|| (!want_stats && is_deterministic(neg[n]))))
|
||||
comp_neg[n] = dtgba_complement(neg[n]);
|
||||
}
|
||||
nf->destroy();
|
||||
}
|
||||
|
||||
spot::cleanup_tmpfiles();
|
||||
|
|
@ -1171,7 +1143,6 @@ namespace
|
|||
}
|
||||
|
||||
spot::ltl::atomic_prop_set* ap = spot::ltl::atomic_prop_collect(f);
|
||||
f->destroy();
|
||||
|
||||
if (want_stats)
|
||||
for (size_t i = 0; i < m; ++i)
|
||||
|
|
|
|||
|
|
@ -238,15 +238,13 @@ namespace
|
|||
int linenum)
|
||||
{
|
||||
spot::ltl::parse_error_list pel;
|
||||
const spot::ltl::formula* f = parse_formula(input, pel);
|
||||
spot::ltl::formula f = parse_formula(input, pel);
|
||||
|
||||
if (!f || !pel.empty())
|
||||
{
|
||||
if (filename)
|
||||
error_at_line(0, 0, filename, linenum, "parse error:");
|
||||
spot::ltl::format_parse_errors(std::cerr, input, pel);
|
||||
if (f)
|
||||
f->destroy();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -257,22 +255,20 @@ namespace
|
|||
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
std::unique_ptr<spot::ltl::relabeling_map> relmap;
|
||||
|
||||
// If atomic propositions are incompatible with one of the
|
||||
// output, relabel the formula.
|
||||
if ((!f->has_lbt_atomic_props() &&
|
||||
if ((!f.has_lbt_atomic_props() &&
|
||||
(runner.has('l') || runner.has('L') || runner.has('T')))
|
||||
|| (!f->has_spin_atomic_props() &&
|
||||
|| (!f.has_spin_atomic_props() &&
|
||||
(runner.has('s') || runner.has('S'))))
|
||||
{
|
||||
relmap.reset(new spot::ltl::relabeling_map);
|
||||
auto g = spot::ltl::relabel(f, spot::ltl::Pnn, relmap.get());
|
||||
f->destroy();
|
||||
f = g;
|
||||
f = spot::ltl::relabel(f, spot::ltl::Pnn, relmap.get());
|
||||
}
|
||||
|
||||
static unsigned round = 1;
|
||||
|
|
@ -297,7 +293,6 @@ namespace
|
|||
nullptr);
|
||||
};
|
||||
}
|
||||
f->destroy();
|
||||
spot::cleanup_tmpfiles();
|
||||
++round;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@
|
|||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlvisit/exclusive.hh"
|
||||
#include "ltlvisit/print.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlast/multop.hh"
|
||||
#include "twaalgos/ltl2tgba_fm.hh"
|
||||
#include "twaalgos/minimize.hh"
|
||||
#include "twaalgos/safety.hh"
|
||||
|
|
@ -261,15 +259,15 @@ static spot::exclusive_ap excl_ap;
|
|||
static std::unique_ptr<output_file> output_define = nullptr;
|
||||
static std::string unabbreviate;
|
||||
|
||||
static const spot::ltl::formula* implied_by = 0;
|
||||
static const spot::ltl::formula* imply = 0;
|
||||
static const spot::ltl::formula* equivalent_to = 0;
|
||||
static spot::ltl::formula implied_by = nullptr;
|
||||
static spot::ltl::formula imply = nullptr;
|
||||
static spot::ltl::formula equivalent_to = nullptr;
|
||||
|
||||
static const spot::ltl::formula*
|
||||
static spot::ltl::formula
|
||||
parse_formula_arg(const std::string& input)
|
||||
{
|
||||
spot::ltl::parse_error_list pel;
|
||||
const spot::ltl::formula* f = parse_formula(input, pel);
|
||||
spot::ltl::formula f = parse_formula(input, pel);
|
||||
if (spot::ltl::format_parse_errors(std::cerr, input, pel))
|
||||
error(2, 0, "parse error when parsing an argument");
|
||||
return f;
|
||||
|
|
@ -342,18 +340,16 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
break;
|
||||
case OPT_IMPLIED_BY:
|
||||
{
|
||||
const spot::ltl::formula* i = parse_formula_arg(arg);
|
||||
spot::ltl::formula i = parse_formula_arg(arg);
|
||||
// a→c∧b→c ≡ (a∨b)→c
|
||||
implied_by =
|
||||
spot::ltl::multop::instance(spot::ltl::multop::Or, implied_by, i);
|
||||
implied_by = spot::ltl::formula::Or({implied_by, i});
|
||||
break;
|
||||
}
|
||||
case OPT_IMPLY:
|
||||
{
|
||||
// a→b∧a→c ≡ a→(b∧c)
|
||||
const spot::ltl::formula* i = parse_formula_arg(arg);
|
||||
imply =
|
||||
spot::ltl::multop::instance(spot::ltl::multop::And, imply, i);
|
||||
spot::ltl::formula i = parse_formula_arg(arg);
|
||||
imply = spot::ltl::formula::And({imply, i});
|
||||
break;
|
||||
}
|
||||
case OPT_LTL:
|
||||
|
|
@ -439,8 +435,7 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
}
|
||||
|
||||
typedef
|
||||
std::unordered_set<const spot::ltl::formula*,
|
||||
const spot::ptr_hash<const spot::ltl::formula>> fset_t;
|
||||
std::unordered_set<spot::ltl::formula> fset_t;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -451,22 +446,8 @@ namespace
|
|||
fset_t unique_set;
|
||||
spot::ltl::relabeling_map relmap;
|
||||
|
||||
~ltl_processor()
|
||||
{
|
||||
fset_t::iterator i = unique_set.begin();
|
||||
while (i != unique_set.end())
|
||||
(*i++)->destroy();
|
||||
|
||||
if (equivalent_to)
|
||||
equivalent_to->destroy();
|
||||
if (implied_by)
|
||||
implied_by->destroy();
|
||||
if (imply)
|
||||
imply->destroy();
|
||||
}
|
||||
|
||||
ltl_processor(spot::ltl::ltl_simplifier& simpl)
|
||||
: simpl(simpl)
|
||||
: simpl(simpl)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +456,7 @@ namespace
|
|||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
spot::ltl::parse_error_list pel;
|
||||
const spot::ltl::formula* f = parse_formula(input, pel);
|
||||
spot::ltl::formula f = parse_formula(input, pel);
|
||||
|
||||
if (!f || pel.size() > 0)
|
||||
{
|
||||
|
|
@ -486,9 +467,6 @@ namespace
|
|||
spot::ltl::format_parse_errors(std::cerr, input, pel);
|
||||
}
|
||||
|
||||
if (f)
|
||||
f->destroy();
|
||||
|
||||
if (error_style == skip_errors)
|
||||
std::cout << input << std::endl;
|
||||
else
|
||||
|
|
@ -508,64 +486,44 @@ namespace
|
|||
}
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
process_formula(spot::ltl::formula f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
if (opt_max_count >= 0 && match_count >= opt_max_count)
|
||||
{
|
||||
abort_run = true;
|
||||
f->destroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (negate)
|
||||
f = spot::ltl::unop::instance(spot::ltl::unop::Not, f);
|
||||
f = spot::ltl::formula::Not(f);
|
||||
|
||||
if (remove_x)
|
||||
{
|
||||
// If simplification are enabled, we do them before and after.
|
||||
if (simplification_level)
|
||||
{
|
||||
const spot::ltl::formula* res = simpl.simplify(f);
|
||||
f->destroy();
|
||||
f = res;
|
||||
}
|
||||
|
||||
const spot::ltl::formula* res = spot::ltl::remove_x(f);
|
||||
f->destroy();
|
||||
f = res;
|
||||
f = simpl.simplify(f);
|
||||
f = spot::ltl::remove_x(f);
|
||||
}
|
||||
|
||||
if (simplification_level || boolean_to_isop)
|
||||
{
|
||||
const spot::ltl::formula* res = simpl.simplify(f);
|
||||
f->destroy();
|
||||
f = res;
|
||||
}
|
||||
f = simpl.simplify(f);
|
||||
|
||||
if (nnf)
|
||||
{
|
||||
const spot::ltl::formula* res = simpl.negative_normal_form(f);
|
||||
f->destroy();
|
||||
f = res;
|
||||
}
|
||||
f = simpl.negative_normal_form(f);
|
||||
|
||||
switch (relabeling)
|
||||
{
|
||||
case ApRelabeling:
|
||||
{
|
||||
relmap.clear();
|
||||
auto res = spot::ltl::relabel(f, style, &relmap);
|
||||
f->destroy();
|
||||
f = res;
|
||||
f = spot::ltl::relabel(f, style, &relmap);
|
||||
break;
|
||||
}
|
||||
case BseRelabeling:
|
||||
{
|
||||
relmap.clear();
|
||||
auto res = spot::ltl::relabel_bse(f, style, &relmap);
|
||||
f->destroy();
|
||||
f = res;
|
||||
f = spot::ltl::relabel_bse(f, style, &relmap);
|
||||
break;
|
||||
}
|
||||
case NoRelabeling:
|
||||
|
|
@ -573,32 +531,24 @@ namespace
|
|||
}
|
||||
|
||||
if (!unabbreviate.empty())
|
||||
{
|
||||
auto res = spot::ltl::unabbreviate(f, unabbreviate.c_str());
|
||||
f->destroy();
|
||||
f = res;
|
||||
}
|
||||
f = spot::ltl::unabbreviate(f, unabbreviate.c_str());
|
||||
|
||||
if (!excl_ap.empty())
|
||||
{
|
||||
auto res = excl_ap.constrain(f);
|
||||
f->destroy();
|
||||
f = res;
|
||||
}
|
||||
f = excl_ap.constrain(f);
|
||||
|
||||
bool matched = true;
|
||||
|
||||
matched &= !ltl || f->is_ltl_formula();
|
||||
matched &= !psl || f->is_psl_formula();
|
||||
matched &= !boolean || f->is_boolean();
|
||||
matched &= !universal || f->is_universal();
|
||||
matched &= !eventual || f->is_eventual();
|
||||
matched &= !syntactic_safety || f->is_syntactic_safety();
|
||||
matched &= !syntactic_guarantee || f->is_syntactic_guarantee();
|
||||
matched &= !syntactic_obligation || f->is_syntactic_obligation();
|
||||
matched &= !syntactic_recurrence || f->is_syntactic_recurrence();
|
||||
matched &= !syntactic_persistence || f->is_syntactic_persistence();
|
||||
matched &= !syntactic_si || f->is_syntactic_stutter_invariant();
|
||||
matched &= !ltl || f.is_ltl_formula();
|
||||
matched &= !psl || f.is_psl_formula();
|
||||
matched &= !boolean || f.is_boolean();
|
||||
matched &= !universal || f.is_universal();
|
||||
matched &= !eventual || f.is_eventual();
|
||||
matched &= !syntactic_safety || f.is_syntactic_safety();
|
||||
matched &= !syntactic_guarantee || f.is_syntactic_guarantee();
|
||||
matched &= !syntactic_obligation || f.is_syntactic_obligation();
|
||||
matched &= !syntactic_recurrence || f.is_syntactic_recurrence();
|
||||
matched &= !syntactic_persistence || f.is_syntactic_persistence();
|
||||
matched &= !syntactic_si || f.is_syntactic_stutter_invariant();
|
||||
matched &= !ap || atomic_prop_collect(f)->size() == ap_n;
|
||||
|
||||
if (matched && (size_min > 0 || size_max >= 0))
|
||||
|
|
@ -643,13 +593,8 @@ namespace
|
|||
|
||||
matched ^= invert;
|
||||
|
||||
if (unique)
|
||||
{
|
||||
if (unique_set.insert(f).second)
|
||||
f->clone();
|
||||
else
|
||||
matched = false;
|
||||
}
|
||||
if (unique && !unique_set.insert(f).second)
|
||||
matched = false;
|
||||
|
||||
if (matched)
|
||||
{
|
||||
|
|
@ -658,7 +603,7 @@ namespace
|
|||
&& output_format != quiet_output)
|
||||
{
|
||||
// Sort the formulas alphabetically.
|
||||
std::map<std::string, const spot::ltl::formula*> m;
|
||||
std::map<std::string, spot::ltl::formula> m;
|
||||
for (auto& p: relmap)
|
||||
m.emplace(str_psl(p.first), p.second);
|
||||
for (auto& p: m)
|
||||
|
|
@ -670,7 +615,6 @@ namespace
|
|||
output_formula_checked(f, filename, linenum, prefix, suffix);
|
||||
++match_count;
|
||||
}
|
||||
f->destroy();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@
|
|||
#include "common_output.hh"
|
||||
#include "common_conv.hh"
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/clone.hh"
|
||||
#include "ltlvisit/apcollect.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlvisit/mutation.hh"
|
||||
|
||||
enum {
|
||||
|
|
@ -100,17 +96,13 @@ namespace
|
|||
{
|
||||
public:
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f, const char *filename = 0,
|
||||
process_formula(spot::ltl::formula f, const char *filename = 0,
|
||||
int linenum = 0)
|
||||
{
|
||||
auto mutations =
|
||||
spot::ltl::mutate(f, mut_opts, max_output, mutation_nb, opt_sort);
|
||||
f->destroy();
|
||||
for (auto g: mutations)
|
||||
{
|
||||
output_formula_checked(g, filename, linenum);
|
||||
g->destroy();
|
||||
}
|
||||
output_formula_checked(g, filename, linenum);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "common_aoutput.hh"
|
||||
#include "common_conv.hh"
|
||||
|
||||
#include "ltlenv/defaultenv.hh"
|
||||
#include "misc/timer.hh"
|
||||
#include "misc/random.hh"
|
||||
|
||||
|
|
@ -252,7 +251,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
|
|||
aprops = spot::ltl::create_atomic_prop_set(ap_count_given.min);
|
||||
break;
|
||||
}
|
||||
aprops.insert(spot::ltl::default_environment::instance().require(arg));
|
||||
aprops.insert(spot::ltl::formula::ap(arg));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -328,7 +327,6 @@ main(int argc, char** argv)
|
|||
if (ap_count_given.max > 0
|
||||
&& ap_count_given.min != ap_count_given.max)
|
||||
{
|
||||
spot::ltl::destroy_atomic_prop_set(aprops);
|
||||
int c = spot::rrand(ap_count_given.min, ap_count_given.max);
|
||||
aprops = spot::ltl::create_atomic_prop_set(c);
|
||||
}
|
||||
|
|
@ -391,5 +389,4 @@ main(int argc, char** argv)
|
|||
{
|
||||
error(2, 0, "%s", e.what());
|
||||
}
|
||||
spot::ltl::destroy_atomic_prop_set(aprops);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,14 +33,9 @@
|
|||
#include "common_conv.hh"
|
||||
|
||||
#include <sstream>
|
||||
#include "ltlast/multop.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlvisit/randomltl.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlvisit/simplify.hh"
|
||||
#include "ltlenv/defaultenv.hh"
|
||||
#include "misc/random.hh"
|
||||
#include "misc/hash.hh"
|
||||
#include "misc/optionmap.hh"
|
||||
|
||||
const char argp_program_doc[] ="\
|
||||
|
|
@ -253,8 +248,8 @@ main(int argc, char** argv)
|
|||
opts.set("output", output);
|
||||
opts.set("tree_size_min", opt_tree_size.min);
|
||||
opts.set("tree_size_max", opt_tree_size.max);
|
||||
opts.set("opt_wf", opt_wf);
|
||||
opts.set("opt_seed", opt_seed);
|
||||
opts.set("wf", opt_wf);
|
||||
opts.set("seed", opt_seed);
|
||||
opts.set("simplification_level", simplification_level);
|
||||
return opts;
|
||||
}(), opt_pL, opt_pS, opt_pB);
|
||||
|
|
@ -291,14 +286,13 @@ main(int argc, char** argv)
|
|||
default:
|
||||
error(2, 0, "internal error: unknown type of output");
|
||||
}
|
||||
destroy_atomic_prop_set(aprops);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
while (opt_formulas < 0 || opt_formulas--)
|
||||
{
|
||||
static int count = 0;
|
||||
const spot::ltl::formula* f = rg.next();
|
||||
spot::ltl::formula f = rg.next();
|
||||
if (!f)
|
||||
{
|
||||
error(2, 0, "failed to generate a new unique formula after %d " \
|
||||
|
|
@ -307,21 +301,17 @@ main(int argc, char** argv)
|
|||
else
|
||||
{
|
||||
output_formula_checked(f, 0, ++count);
|
||||
f->destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
destroy_atomic_prop_set(aprops);
|
||||
error(2, 0, "%s", e.what());
|
||||
}
|
||||
catch (const std::invalid_argument& e)
|
||||
{
|
||||
destroy_atomic_prop_set(aprops);
|
||||
error(2, 0, "%s", e.what());
|
||||
}
|
||||
|
||||
destroy_atomic_prop_set(aprops);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue