Commit 689aa7fd authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

translate: add support for -x tls-impl=N

This is long overdue, and we probably want to use tls-impl=1 in
ltlsynt.

* spot/twaalgos/translate.cc, spot/twaalgos/translate.hh:
Add support for tls-impl=N.
* tests/core/ltl2tgba.test: Test it.
* bin/spot-x.cc, NEWS: Document it.
parent 9b187297
......@@ -36,6 +36,10 @@ New in spot 2.4.1.dev (not yet released)
- ltldo learned to limit the number of automata it outputs using -n.
- The new -x tls-impl=N option allows to fine-tune the
implication-based simplification rules of ltl2tgba. See the
spot-x man-page for details.
Library:
- Rename three methods of spot::scc_info. New names are clearer. The
......
......@@ -37,6 +37,13 @@ value) is a shorthand for KEY=1, while !KEY is a shorthand for KEY=0.";
static const argp_option options[] =
{
{ nullptr, 0, nullptr, 0, "Temporal logic simplification options:", 0 },
{ DOC("tls-impl",
"Control usage of implication-based rewriting. \
(0) disables it, (1) enables rules based on syntactic implications, \
(2) additionally allows automata-based implication checks, (3) enables \
more rules based on automata-based implication checks. The default value \
depends on the --low/--medium/--high settings.") },
{ nullptr, 0, nullptr, 0, "Translation options:", 0 },
{ DOC("comp-susp", "Set to 1 to enable compositional suspension, \
as described in our SPIN'13 paper (see Bibliography below). Set to 2, \
......
......@@ -30,7 +30,7 @@ namespace spot
void translator::setup_opt(const option_map* opt)
{
comp_susp_ = early_susp_ = skel_wdba_ = skel_simul_ = 0;
relabel_bool_ = -1;
relabel_bool_ = tls_impl_ = -1;
if (!opt)
return;
......@@ -43,6 +43,7 @@ namespace spot
skel_wdba_ = opt->get("skel-wdba", -1);
skel_simul_ = opt->get("skel-simul", 1);
}
tls_impl_ = opt->get("tls-impl", -1);
}
void translator::build_simplifier(const bdd_dict_ptr& dict)
......@@ -61,6 +62,34 @@ namespace spot
options.reduce_basics = true;
options.event_univ = true;
}
// User-supplied fine-tuning?
if (tls_impl_ >= 0)
switch (tls_impl_)
{
case 0:
options.synt_impl = false;
options.containment_checks = false;
options.containment_checks_stronger = false;
break;
case 1:
options.synt_impl = true;
options.containment_checks = false;
options.containment_checks_stronger = false;
break;
case 2:
options.synt_impl = true;
options.containment_checks = true;
options.containment_checks_stronger = false;
break;
case 3:
options.synt_impl = true;
options.containment_checks = true;
options.containment_checks_stronger = true;
break;
default:
throw std::runtime_error
("tls-impl should take a value between 0 and 3");
}
simpl_owned_ = simpl_ = new tl_simplifier(options, dict);
}
......
......@@ -74,15 +74,15 @@ namespace spot
translator(const bdd_dict_ptr& dict, const option_map* opt = nullptr)
: postprocessor(opt)
{
build_simplifier(dict);
setup_opt(opt);
build_simplifier(dict);
}
translator(const option_map* opt = nullptr)
: postprocessor(opt)
{
build_simplifier(make_bdd_dict());
setup_opt(opt);
build_simplifier(make_bdd_dict());
}
~translator()
......@@ -147,6 +147,7 @@ namespace spot
int skel_wdba_;
int skel_simul_;
int relabel_bool_;
int tls_impl_;
};
/// @}
}
......@@ -270,3 +270,11 @@ test 3 = `ltl2tgba -f 'G(Fa & Fb) U a' --stats=%s`
# report inconsistent "universal" property.
ltl2tgba --low 'X(((1) U (p1)) | (((p1) | (F(p0))) U ((0) R ((p2) M (p1)))))'>o
grep deterministic o
# test tls-impl=N
f='(Fp0 W p0) & G((Gp0 W Xp0) M !Gp1)'
ltl2tgba -f "$f" --low -x tls-impl=4 --stats=%s && exit 1
test 4 = `ltl2tgba -f "$f" --low -x tls-impl=0 --stats=%s`
test 3 = `ltl2tgba -f "$f" --low -x tls-impl=1 --stats=%s`
test 2 = `ltl2tgba -f "$f" --low -x tls-impl=2 --stats=%s`
test 2 = `ltl2tgba -f "$f" --low -x tls-impl=3 --stats=%s`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment