bin: add support for -b/--buchi

* bin/common_post.cc, bin/randaut.cc: Implement -b/--buchi.
Also add --sba as alias for -B, and --gba as alias for --tgba.
* NEWS: Document those changes.
* doc/org/ltl2tgba.org, doc/org/oaut.org: Adjust documentation.
* tests/core/ltl2tgba2.test, tests/core/ltlcross2.test,
tests/core/randaut.test: Add more tests.
* tests/core/sbacc.test: --sbacc cannot be abbreviated as --sba
anymore.
This commit is contained in:
Alexandre Duret-Lutz 2020-12-15 17:55:39 +01:00
parent 7c6b35313a
commit 8785f5a74b
9 changed files with 520 additions and 479 deletions

View file

@ -50,9 +50,15 @@ static constexpr const argp_option options[] =
{ "generic", 'G', nullptr, 0,
"any acceptance condition is allowed", 0 },
{ "tgba", OPT_TGBA, nullptr, 0,
"Transition-based Generalized Büchi Automaton (default)", 0 },
{ "ba", 'B', nullptr, 0,
"Büchi Automaton (implies -S)", 0 },
"automaton with Generalized Büchi acceptance (default)", 0 },
{ "gba", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "sba", 'B', nullptr, 0,
"state-based Büchi Automaton (same as -S -b)", 0 },
// Historical name of the --sba option.
{ "ba", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "buchi", 'b', nullptr, 0,
"automaton with Büchi acceptance", 0 },
{ "Buchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "monitor", 'M', nullptr, 0, "Monitor (accepts all finite prefixes "
"of the given property)", 0 },
{ "complete", 'C', nullptr, 0, "output a complete automaton", 0 },
@ -113,9 +119,15 @@ static const argp_option options_disabled[] =
{ "generic", 'G', nullptr, 0,
"any acceptance is allowed (default)", 0 },
{ "tgba", OPT_TGBA, nullptr, 0,
"Transition-based Generalized Büchi Automaton", 0 },
{ "ba", 'B', nullptr, 0,
"Büchi Automaton (with state-based acceptance)", 0 },
"automaton with Generalized Büchi acceptance", 0 },
{ "gba", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "sba", 'B', nullptr, 0,
"state-based Büchi Automaton (same as -S -b)", 0 },
// Historical name of the --sba option.
{ "ba", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "buchi", 'b', nullptr, 0,
"automaton with Büchi acceptance", 0 },
{ "Buchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "monitor", 'M', nullptr, 0, "Monitor (accepts all finite prefixes "
"of the given property)", 0 },
{ "complete", 'C', nullptr, 0, "output a complete automaton", 0 },
@ -164,6 +176,10 @@ parse_opt_post(int key, char* arg, struct argp_state*)
pref = spot::postprocessor::Any;
pref_set = true;
break;
case 'b':
type = spot::postprocessor::Buchi;
colored = spot::postprocessor::Any;
break;
case 'B':
type = spot::postprocessor::Buchi;
colored = spot::postprocessor::Any;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012-2016, 2018-2019 Laboratoire de Recherche et
// Copyright (C) 2012-2016, 2018-2020 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -81,8 +81,14 @@ static const argp_option options[] =
"probability that an edge belongs to one acceptance set (0.2)", 0 },
{ "automata", 'n', "INT", 0, "number of automata to output (1)\n"\
"use a negative value for unbounded generation", 0 },
{ "ba", 'B', nullptr, 0,
"build a Buchi automaton (implies --acceptance=Buchi --state-acc)", 0 },
{ "sba", 'B', nullptr, 0,
"build a state-based Buchi automaton "
"(implies --acceptance=Buchi --state-acc)", 0 },
// historical name for --sba
{ "ba", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "buchi", 'b', nullptr, 0,
"build a Büchi automaton (same as --acceptance=Buchi)", 0 },
{ "Buchi", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "colored", OPT_COLORED, nullptr, 0,
"build an automaton in which each edge (or state if combined with "
"-S) belong to a single acceptance set", 0 },
@ -161,10 +167,10 @@ static bool gba_wanted = false;
static std::unique_ptr<unique_aut_t> opt_uniq = nullptr;
static void
ba_options()
ba_options(bool sbacc)
{
opt_acc_sets = { 1, 1 };
opt_state_acc = true;
opt_state_acc = sbacc;
}
// Range should have the form 12..34 or 12:34, maybe with spaces. The
@ -209,8 +215,12 @@ parse_opt(int key, char* arg, struct argp_state* as)
generic_wanted = true;
}
break;
case 'b':
ba_options(false);
ba_wanted = true;
break;
case 'B':
ba_options();
ba_options(true);
ba_wanted = true;
break;
case 'e':
@ -300,20 +310,22 @@ main(int argc, char** argv)
error(2, 0,
"--spin implies --ba so should not be used with --acceptance");
if (generic_wanted && ba_wanted)
error(2, 0, "--acceptance and --ba may not be used together");
error(2, 0, "--acceptance and %s may not be used together",
opt_state_acc ? "--ba" : "--buchi");
if (automaton_format == Spin && opt_acc_sets.max > 1)
error(2, 0, "--spin is incompatible with --acceptance=%d..%d",
opt_acc_sets.min, opt_acc_sets.max);
if (ba_wanted && opt_acc_sets.min != 1 && opt_acc_sets.max != 1)
error(2, 0, "--ba is incompatible with --acceptance=%d..%d",
error(2, 0, "%s is incompatible with --acceptance=%d..%d",
opt_state_acc ? "--ba" : "--buchi",
opt_acc_sets.min, opt_acc_sets.max);
if (ba_wanted && generic_wanted)
error(2, 0,
"--ba is incompatible with --acceptance=%s", opt_acceptance);
if (automaton_format == Spin)
ba_options();
ba_options(true);
if (opt_colored && opt_acc_sets.min == -1 && !generic_wanted)
error(2, 0, "--colored requires at least one acceptance set; "