Merge branch master (Spot 1.2.5) into next.
* src/bin/dstar2tgba.cc, src/bin/ltlcross.cc, src/bin/randltl.cc, src/ltltest/reduccmp.test, src/neverparse/neverclaimparse.yy, src/tgbatest/ltl2ta.test, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlcross.test, src/tgbatest/neverclaimread.test, wrap/python/ajax/ltl2tgba.html: Fix conflicts.
This commit is contained in:
commit
700cf88b06
30 changed files with 1029 additions and 163 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
//
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#include "ltlast/formula.hh"
|
||||
#include "tgbaalgos/dotty.hh"
|
||||
#include "tgbaalgos/lbtt.hh"
|
||||
#include "tgbaalgos/hoaf.hh"
|
||||
#include "tgbaalgos/neverclaim.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
#include "tgbaalgos/stats.hh"
|
||||
|
|
@ -71,6 +72,10 @@ static const argp_option options[] =
|
|||
/**************************************************/
|
||||
{ 0, 0, 0, 0, "Output format:", 3 },
|
||||
{ "dot", OPT_DOT, 0, 0, "GraphViz's format (default)", 0 },
|
||||
{ "hoaf", 'H', "s|t|m|l", OPTION_ARG_OPTIONAL,
|
||||
"Output the automaton in HOA format. Add letters to select "
|
||||
"(s) state-based acceptance, (t) transition-based acceptance, "
|
||||
"(m) mixed acceptance, (l) single-line output", 0 },
|
||||
{ "lbtt", OPT_LBTT, "t", OPTION_ARG_OPTIONAL,
|
||||
"LBTT's format (add =t to force transition-based acceptance even"
|
||||
" on Büchi automata)", 0 },
|
||||
|
|
@ -121,9 +126,10 @@ const struct argp_child children[] =
|
|||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats } format = Dot;
|
||||
enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats, Hoa } format = Dot;
|
||||
bool utf8 = false;
|
||||
const char* stats = "";
|
||||
const char* hoaf_opt = 0;
|
||||
spot::option_map extra_options;
|
||||
|
||||
static int
|
||||
|
|
@ -141,6 +147,10 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
case 'F':
|
||||
jobs.emplace_back(arg, true);
|
||||
break;
|
||||
case 'H':
|
||||
format = Hoa;
|
||||
hoaf_opt = arg;
|
||||
break;
|
||||
case 'M':
|
||||
type = spot::postprocessor::Monitor;
|
||||
break;
|
||||
|
|
@ -317,6 +327,9 @@ namespace
|
|||
case Lbtt_t:
|
||||
spot::lbtt_reachable(std::cout, aut, false);
|
||||
break;
|
||||
case Hoa:
|
||||
spot::hoaf_reachable(std::cout, aut, hoaf_opt) << '\n';
|
||||
break;
|
||||
case Spot:
|
||||
spot::tgba_save_reachable(std::cout, aut);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "tgbaalgos/lbtt.hh"
|
||||
#include "tgbaalgos/neverclaim.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
#include "tgbaalgos/hoaf.hh"
|
||||
#include "tgbaalgos/stats.hh"
|
||||
#include "tgbaalgos/translate.hh"
|
||||
#include "tgba/bddprint.hh"
|
||||
|
|
@ -72,6 +73,10 @@ static const argp_option options[] =
|
|||
{ "csv-escape", OPT_CSV, 0, 0, "quote formula output by %f in --format "
|
||||
"for use in CSV file", 0 },
|
||||
{ "dot", OPT_DOT, 0, 0, "GraphViz's format (default)", 0 },
|
||||
{ "hoaf", 'H', "s|t|m|l", OPTION_ARG_OPTIONAL,
|
||||
"Output the automaton in HOA format. Add letters to select "
|
||||
"(s) state-based acceptance, (t) transition-based acceptance, "
|
||||
"(m) mixed acceptance, (l) single-line output", 0 },
|
||||
{ "lbtt", OPT_LBTT, "t", OPTION_ARG_OPTIONAL,
|
||||
"LBTT's format (add =t to force transition-based acceptance even"
|
||||
" on Büchi automata)", 0 },
|
||||
|
|
@ -118,9 +123,10 @@ const struct argp_child children[] =
|
|||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats } format = Dot;
|
||||
enum output_format { Dot, Lbtt, Lbtt_t, Spin, Spot, Stats, Hoa } format = Dot;
|
||||
bool utf8 = false;
|
||||
const char* stats = "";
|
||||
const char* hoaf_opt = 0;
|
||||
spot::option_map extra_options;
|
||||
|
||||
static int
|
||||
|
|
@ -136,6 +142,10 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
case 'B':
|
||||
type = spot::postprocessor::BA;
|
||||
break;
|
||||
case 'H':
|
||||
format = Hoa;
|
||||
hoaf_opt = arg;
|
||||
break;
|
||||
case 'M':
|
||||
type = spot::postprocessor::Monitor;
|
||||
break;
|
||||
|
|
@ -244,6 +254,9 @@ namespace
|
|||
case Lbtt_t:
|
||||
spot::lbtt_reachable(std::cout, aut, false);
|
||||
break;
|
||||
case Hoa:
|
||||
spot::hoaf_reachable(std::cout, aut, hoaf_opt, f) << '\n';
|
||||
break;
|
||||
case Spot:
|
||||
spot::tgba_save_reachable(std::cout, aut);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ Exit status:\n\
|
|||
#define OPT_COLOR 10
|
||||
#define OPT_NOCOMP 11
|
||||
#define OPT_OMIT 12
|
||||
#define OPT_BOGUS 13
|
||||
|
||||
static const argp_option options[] =
|
||||
{
|
||||
|
|
@ -160,6 +161,8 @@ static const argp_option options[] =
|
|||
"colorize output; WHEN can be 'never', 'always' (the default if "
|
||||
"--color is used without argument), or "
|
||||
"'auto' (the default if --color is not used)", 0 },
|
||||
{ "save-bogus", OPT_BOGUS, "FILENAME", 0,
|
||||
"save formulas for which problems were detected in FILENAME", 0 },
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -188,7 +191,7 @@ ARGMATCH_VERIFY(color_args, color_types);
|
|||
|
||||
color_type color_opt = color_if_tty;
|
||||
const char* bright_red = "\033[01;31m";
|
||||
const char* bright_white = "\033[01;37m";
|
||||
const char* bright_blue = "\033[01;34m";
|
||||
const char* bright_yellow = "\033[01;33m";
|
||||
const char* reset_color = "\033[m";
|
||||
|
||||
|
|
@ -207,6 +210,8 @@ unsigned products = 1;
|
|||
bool products_avg = true;
|
||||
bool opt_omit = false;
|
||||
bool has_sr = false; // Has Streett or Rabin automata to process.
|
||||
const char* bogus_output_filename = 0;
|
||||
std::ofstream* bogus_output = 0;
|
||||
|
||||
struct translator_spec
|
||||
{
|
||||
|
|
@ -510,6 +515,14 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
<< "on your platform" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
case OPT_BOGUS:
|
||||
{
|
||||
bogus_output = new std::ofstream(arg);
|
||||
if (!*bogus_output)
|
||||
error(2, errno, "cannot open '%s'", arg);
|
||||
bogus_output_filename = arg;
|
||||
break;
|
||||
}
|
||||
case OPT_COLOR:
|
||||
{
|
||||
if (arg)
|
||||
|
|
@ -850,7 +863,8 @@ namespace
|
|||
}
|
||||
|
||||
spot::const_tgba_ptr
|
||||
translate(unsigned int translator_num, char l, statistics_formula* fstats)
|
||||
translate(unsigned int translator_num, char l, statistics_formula* fstats,
|
||||
bool& problem)
|
||||
{
|
||||
output.reset(translator_num);
|
||||
|
||||
|
|
@ -875,11 +889,13 @@ namespace
|
|||
std::cerr << "warning: timeout during execution of command\n";
|
||||
++timeout_count;
|
||||
status_str = "timeout";
|
||||
problem = false; // A timeout is not a sign of a bug
|
||||
es = -1;
|
||||
}
|
||||
else if (WIFSIGNALED(es))
|
||||
{
|
||||
status_str = "signal";
|
||||
problem = true;
|
||||
es = WTERMSIG(es);
|
||||
global_error() << "error: execution terminated by signal "
|
||||
<< es << ".\n";
|
||||
|
|
@ -889,6 +905,7 @@ namespace
|
|||
{
|
||||
es = WEXITSTATUS(es);
|
||||
status_str = "exit code";
|
||||
problem = true;
|
||||
global_error() << "error: execution returned exit code "
|
||||
<< es << ".\n";
|
||||
end_error();
|
||||
|
|
@ -896,6 +913,7 @@ namespace
|
|||
else
|
||||
{
|
||||
status_str = "ok";
|
||||
problem = false;
|
||||
es = 0;
|
||||
switch (output.format)
|
||||
{
|
||||
|
|
@ -907,6 +925,7 @@ namespace
|
|||
if (!pel.empty())
|
||||
{
|
||||
status_str = "parse error";
|
||||
problem = true;
|
||||
es = -1;
|
||||
std::ostream& err = global_error();
|
||||
err << "error: failed to parse the produced neverclaim.\n";
|
||||
|
|
@ -923,6 +942,7 @@ namespace
|
|||
if (!f)
|
||||
{
|
||||
status_str = "no output";
|
||||
problem = true;
|
||||
es = -1;
|
||||
global_error() << "Cannot open " << output.val()
|
||||
<< std::endl;
|
||||
|
|
@ -934,6 +954,7 @@ namespace
|
|||
if (!res)
|
||||
{
|
||||
status_str = "parse error";
|
||||
problem = true;
|
||||
es = -1;
|
||||
global_error() << ("error: failed to parse output in "
|
||||
"LBTT format: ")
|
||||
|
|
@ -951,6 +972,7 @@ namespace
|
|||
if (!pel.empty())
|
||||
{
|
||||
status_str = "parse error";
|
||||
problem = true;
|
||||
es = -1;
|
||||
std::ostream& err = global_error();
|
||||
err << "error: failed to parse the produced DSTAR"
|
||||
|
|
@ -1043,7 +1065,7 @@ namespace
|
|||
}
|
||||
};
|
||||
|
||||
static void
|
||||
static bool
|
||||
check_empty_prod(const spot::const_tgba_ptr& aut_i,
|
||||
const spot::const_tgba_ptr& aut_j,
|
||||
size_t i, size_t j, bool icomp, bool jcomp)
|
||||
|
|
@ -1086,9 +1108,10 @@ namespace
|
|||
}
|
||||
delete res;
|
||||
delete ec;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
cross_check(const std::vector<spot::scc_map*>& maps, char l, unsigned p)
|
||||
{
|
||||
size_t m = maps.size();
|
||||
|
|
@ -1141,7 +1164,9 @@ namespace
|
|||
else
|
||||
err << "the state-space\n";
|
||||
end_error();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef std::set<spot::state*, spot::state_ptr_less_than> state_set;
|
||||
|
|
@ -1204,12 +1229,35 @@ namespace
|
|||
(*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);
|
||||
|
||||
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;
|
||||
}
|
||||
int res = process_formula(f, filename, linenum);
|
||||
|
||||
if (res && bogus_output)
|
||||
*bogus_output << input << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
process_formula(const spot::ltl::formula* f,
|
||||
const char* filename = 0, int linenum = 0)
|
||||
{
|
||||
(void) filename;
|
||||
(void) linenum;
|
||||
static unsigned round = 0;
|
||||
|
||||
// If we need LBT atomic proposition in any of the input or
|
||||
|
|
@ -1236,7 +1284,7 @@ namespace
|
|||
if (filename || linenum)
|
||||
std::cerr << ' ';
|
||||
if (color_opt)
|
||||
std::cerr << bright_white;
|
||||
std::cerr << bright_blue;
|
||||
std::cerr << fstr << '\n';
|
||||
if (color_opt)
|
||||
std::cerr << reset_color;
|
||||
|
|
@ -1260,6 +1308,9 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int problems = 0;
|
||||
|
||||
// These store the result of the translation of the positive and
|
||||
// negative formulas.
|
||||
size_t m = translators.size();
|
||||
|
|
@ -1280,7 +1331,10 @@ namespace
|
|||
|
||||
for (size_t n = 0; n < m; ++n)
|
||||
{
|
||||
pos[n] = runner.translate(n, 'P', pstats);
|
||||
bool prob;
|
||||
pos[n] = runner.translate(n, 'P', pstats, prob);
|
||||
problems += prob;
|
||||
|
||||
// If the automaton is deterministic, compute its complement
|
||||
// as well. Note that if we have computed statistics
|
||||
// already, there is no need to call is_deterministic()
|
||||
|
|
@ -1318,7 +1372,10 @@ namespace
|
|||
|
||||
for (size_t n = 0; n < m; ++n)
|
||||
{
|
||||
neg[n] = runner.translate(n, 'N', nstats);
|
||||
bool prob;
|
||||
neg[n] = runner.translate(n, 'N', nstats, prob);
|
||||
problems += prob;
|
||||
|
||||
// If the automaton is deterministic, compute its
|
||||
// complement as well. Note that if we have computed
|
||||
// statistics already, there is no need to call
|
||||
|
|
@ -1345,7 +1402,8 @@ namespace
|
|||
for (size_t j = 0; j < m; ++j)
|
||||
if (neg[j])
|
||||
{
|
||||
check_empty_prod(pos[i], neg[j], i, j, false, false);
|
||||
problems +=
|
||||
check_empty_prod(pos[i], neg[j], i, j, false, false);
|
||||
|
||||
// Deal with the extra complemented automata if we
|
||||
// have some.
|
||||
|
|
@ -1363,13 +1421,18 @@ namespace
|
|||
// translation was not deterministic.
|
||||
|
||||
if (i != j && comp_pos[j] && !comp_neg[j])
|
||||
check_empty_prod(pos[i], comp_pos[j], i, j, false, true);
|
||||
problems +=
|
||||
check_empty_prod(pos[i], comp_pos[j],
|
||||
i, j, false, true);
|
||||
if (i != j && comp_neg[i] && !comp_neg[i])
|
||||
check_empty_prod(comp_neg[i], neg[j], i, j, true, false);
|
||||
problems +=
|
||||
check_empty_prod(comp_neg[i], neg[j],
|
||||
i, j, true, false);
|
||||
if (comp_pos[i] && comp_neg[j] &&
|
||||
(i == j || (!comp_neg[i] && !comp_pos[j])))
|
||||
check_empty_prod(comp_pos[i], comp_neg[j],
|
||||
i, j, true, true);
|
||||
problems +=
|
||||
check_empty_prod(comp_pos[i], comp_neg[j],
|
||||
i, j, true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1448,14 +1511,16 @@ namespace
|
|||
if (!no_checks)
|
||||
{
|
||||
// cross-comparison test
|
||||
cross_check(pos_map, 'P', p);
|
||||
cross_check(neg_map, 'N', p);
|
||||
problems += cross_check(pos_map, 'P', p);
|
||||
problems += cross_check(neg_map, 'N', p);
|
||||
|
||||
// consistency check
|
||||
for (size_t i = 0; i < m; ++i)
|
||||
if (pos_map[i] && neg_map[i] &&
|
||||
!(consistency_check(pos_map[i], neg_map[i], statespace)))
|
||||
{
|
||||
++problems;
|
||||
|
||||
std::ostream& err = global_error();
|
||||
err << "error: inconsistency between P" << i
|
||||
<< " and N" << i;
|
||||
|
|
@ -1481,7 +1546,7 @@ namespace
|
|||
|
||||
// Shall we stop processing formulas now?
|
||||
abort_run = global_error_flag && stop_on_error;
|
||||
return 0;
|
||||
return problems;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1499,7 +1564,7 @@ print_stats_csv(const char* filename)
|
|||
else
|
||||
{
|
||||
out = outfile = new std::ofstream(filename);
|
||||
if (!outfile)
|
||||
if (!*outfile)
|
||||
error(2, errno, "cannot open '%s'", filename);
|
||||
}
|
||||
|
||||
|
|
@ -1537,7 +1602,7 @@ print_stats_json(const char* filename)
|
|||
else
|
||||
{
|
||||
out = outfile = new std::ofstream(filename);
|
||||
if (!outfile)
|
||||
if (!*outfile)
|
||||
error(2, errno, "cannot open '%s'", filename);
|
||||
}
|
||||
|
||||
|
|
@ -1616,10 +1681,16 @@ main(int argc, char** argv)
|
|||
if (global_error_flag)
|
||||
{
|
||||
std::ostream& err = global_error();
|
||||
err << ("error: some error was detected during the above runs,\n"
|
||||
" please search for 'error:' messages in the above "
|
||||
"trace.")
|
||||
<< std::endl;
|
||||
if (bogus_output)
|
||||
err << ("error: some error was detected during the above runs.\n"
|
||||
" Check file ")
|
||||
<< bogus_output_filename
|
||||
<< " for problematic formulas.";
|
||||
else
|
||||
err << ("error: some error was detected during the above runs,\n"
|
||||
" please search for 'error:' messages in the above"
|
||||
" trace.");
|
||||
err << std::endl;
|
||||
if (timeout_count == 1)
|
||||
err << "Additionally, 1 timeout occurred." << std::endl;
|
||||
else if (timeout_count > 1)
|
||||
|
|
@ -1636,6 +1707,8 @@ main(int argc, char** argv)
|
|||
<< " timeouts, but no other problem detected." << std::endl;
|
||||
}
|
||||
|
||||
delete bogus_output;
|
||||
|
||||
if (json_output)
|
||||
print_stats_json(json_output);
|
||||
if (csv_output)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,42 @@
|
|||
[NAME]
|
||||
ltl2tgba \- translate LTL/PSL formulas into Büchi automata
|
||||
[NOTE ON TGBA]
|
||||
|
||||
TGBA stands for Transition-based Generalized Büchi Automaton. The
|
||||
name was coined by Dimitra Giannakopoulou and Flavio Lerda in their
|
||||
FORTE'02 paper (From States to Transitions: Improving Translation of
|
||||
LTL Formulae to Büchi Automata), although similar automata have been
|
||||
used under different names long before that.
|
||||
|
||||
As its name implies a TGBA uses a generalized Büchi acceptance
|
||||
condition, meanings that a run of the automaton is accepted iff it
|
||||
visits ininitely often multiple acceptance sets, and it also uses
|
||||
transition-based acceptance, i.e., those acceptance sets are sets of
|
||||
transitions. TGBA are often more consise than traditional Büchi
|
||||
automata. For instance the LTL formula \f(CWGFa & GFb\fR can be
|
||||
translated into a single-state TGBA while a traditional Büchi
|
||||
automaton would need 3 states. Compare
|
||||
|
||||
% ltl2tgba 'GFa & GFb'
|
||||
|
||||
with
|
||||
|
||||
% ltl2tgba --ba 'GFa & GFb'
|
||||
|
||||
In the dot output produced by the above commands, the membership of
|
||||
the transitions to the various acceptance sets is denoted using names
|
||||
in braces. The actuall names do not really matter as they may be
|
||||
produced by the translation algorithm or altered by any latter
|
||||
postprocessing.
|
||||
|
||||
When the \fB\--ba\fR option is used to request a Büchi automaton, Spot
|
||||
builds a TGBA with a single acceptance set, and in which for any state
|
||||
either all outgoing transitions are accepting (this is equivalent to
|
||||
the state being accepting) or none of them are. Double circles are
|
||||
used to highlight accepting states in the output, but the braces
|
||||
denoting the accepting transitions are still shown because the
|
||||
underling structure really is a TGBA.
|
||||
|
||||
[NOTE ON LBTT'S FORMAT]
|
||||
The format, described at
|
||||
http://www.tcs.hut.fi/Software/lbtt/doc/html/Format-for-automata.html,
|
||||
|
|
@ -10,7 +47,7 @@ internally, it will normally use the transition-based flavor of that
|
|||
format, indicated with a 't' flag after the number of acceptance sets.
|
||||
For instance:
|
||||
|
||||
% bin/ltl2tgba --lbtt 'GFp0 & GFp1 & FGp2'
|
||||
% ltl2tgba --lbtt 'GFp0 & GFp1 & FGp2'
|
||||
2 2t // 2 states, 2 transition-based acceptance sets
|
||||
0 1 // state 0: initial
|
||||
0 -1 t // trans. to state 0, no acc., label: true
|
||||
|
|
@ -80,6 +117,38 @@ p[0-9]+ as double-quoted strings.
|
|||
0 -1 & ! "b" ! "a"
|
||||
-1
|
||||
|
||||
[NOTE ON GENERATING MONITORS]
|
||||
|
||||
The monitors generated with option \fB\-M\fR are finite state automata
|
||||
used to reject finite words that cannot be extended to infinite words
|
||||
compatible with the supplied formula. The idea is that the monitor
|
||||
should progress alongside the system, and can only make decisions
|
||||
based on the finite prefix read so far.
|
||||
|
||||
Monitors can be seen as Büchi automata in which all recognized runs are
|
||||
accepting. As such, the only infinite words they can reject are those
|
||||
are not recognized, i.e., infinite words that start with a bad prefix.
|
||||
|
||||
Because of this limited expressiveness, a monitor for some given LTL
|
||||
or PSL formula may accept a larger language than the one specified by
|
||||
the formula. For instance a monitor for the LTL formula \f(CWa U b\fR
|
||||
will reject (for instance) any word starting with \f(CW!a&!b\fR as
|
||||
there is no way such a word can validate the formula, but it will not
|
||||
reject a finite prefix repeating only \f(CWa&!b\fR as such a prefix
|
||||
could be extented in a way that is comptible with \f(CWa U b\fR.
|
||||
|
||||
For more information about monitors, we refer the readers to the
|
||||
following two papers (the first paper describes the construction of
|
||||
the second paper in a more concise way):
|
||||
.TP
|
||||
\(bu
|
||||
Deian Tabakov and Moshe Y. Vardi: Optimized Temporal Monitors for SystemC.
|
||||
Proceedings of RV'10. LNCS 6418.
|
||||
.TP
|
||||
\(bu
|
||||
Marcelo d’Amorim and Grigoire Roşu: Efficient monitoring of
|
||||
ω-languages. Proceedings of CAV'05. LNCS 3576.
|
||||
|
||||
[BIBLIOGRAPHY]
|
||||
If you would like to give a reference to this tool in an article,
|
||||
we suggest you cite one of the following papers:
|
||||
|
|
|
|||
|
|
@ -44,13 +44,19 @@
|
|||
#include "misc/hash.hh"
|
||||
|
||||
const char argp_program_doc[] ="\
|
||||
Generate random temporal logic formulas.\v\
|
||||
Generate random temporal logic formulas.\n\n\
|
||||
The formulas are built over the atomic propositions named by PROPS...\n\
|
||||
or, if N is a nonnegative number, using N arbitrary names.\v\
|
||||
Examples:\n\
|
||||
\n\
|
||||
The following generates 10 random LTL formulas over the propositions a, b,\n\
|
||||
and c, with the default tree-size, and all available operators.\n\
|
||||
% randltl -n10 a b c\n\
|
||||
\n\
|
||||
If you do not mind about the name of the atomic propositions, just give\n\
|
||||
a number instead:\n\
|
||||
% ./randltl -n10 3\n\
|
||||
\n\
|
||||
You can disable or favor certain operators by changing their priority.\n\
|
||||
The following disables xor, implies, and equiv, and multiply the probability\n\
|
||||
of X to occur by 10.\n\
|
||||
|
|
@ -139,6 +145,7 @@ static int opt_seed = 0;
|
|||
static range opt_tree_size = { 15, 15 };
|
||||
static bool opt_unique = true;
|
||||
static bool opt_wf = false;
|
||||
static bool ap_count_given = false;
|
||||
|
||||
void
|
||||
remove_some_props(spot::ltl::atomic_prop_set& s)
|
||||
|
|
@ -184,7 +191,7 @@ to_int(const char* s)
|
|||
}
|
||||
|
||||
static int
|
||||
parse_opt(int key, char* arg, struct argp_state*)
|
||||
parse_opt(int key, char* arg, struct argp_state* as)
|
||||
{
|
||||
// This switch is alphabetically-ordered.
|
||||
switch (key)
|
||||
|
|
@ -235,6 +242,32 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
opt_wf = true;
|
||||
break;
|
||||
case ARGP_KEY_ARG:
|
||||
// If this is the unique non-option argument, it can
|
||||
// be a number of atomic propositions to build.
|
||||
//
|
||||
// argp reorganizes argv[] so that options always come before
|
||||
// non-options. So if as->argc == as->next we know this is the
|
||||
// last non-option argument, and if aprops.empty() we know this
|
||||
// is the also the first one.
|
||||
if (aprops.empty() && as->argc == as->next)
|
||||
{
|
||||
char* endptr;
|
||||
int res = strtol(arg, &endptr, 10);
|
||||
if (!*endptr && res >= 0) // arg is a number
|
||||
{
|
||||
ap_count_given = true;
|
||||
spot::ltl::default_environment& e =
|
||||
spot::ltl::default_environment::instance();
|
||||
for (int i = 0; i < res; ++i)
|
||||
{
|
||||
std::ostringstream p;
|
||||
p << 'p' << i;
|
||||
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
|
||||
(e.require(p.str())));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
|
||||
(spot::ltl::default_environment::instance().require(arg)));
|
||||
break;
|
||||
|
|
@ -249,7 +282,7 @@ main(int argc, char** argv)
|
|||
{
|
||||
setup(argv);
|
||||
|
||||
const argp ap = { options, parse_opt, "PROP...", argp_program_doc,
|
||||
const argp ap = { options, parse_opt, "N|PROP...", argp_program_doc,
|
||||
children, 0, 0 };
|
||||
|
||||
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, 0, 0))
|
||||
|
|
@ -339,14 +372,17 @@ main(int argc, char** argv)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
if (aprops.empty())
|
||||
// running 'randltl 0' is one way to generate formulas using no
|
||||
// atomic propositions so do not complain in that case.
|
||||
if (aprops.empty() && !ap_count_given)
|
||||
error(2, 0, "No atomic proposition supplied? Run '%s --help' for usage.",
|
||||
program_name);
|
||||
|
||||
spot::srand(opt_seed);
|
||||
|
||||
typedef
|
||||
std::unordered_set<const spot::ltl::formula*,
|
||||
const spot::ptr_hash<const spot::ltl::formula>> fset_t;
|
||||
|
||||
fset_t unique_set;
|
||||
|
||||
spot::ltl::ltl_simplifier simpl(simplifier_options());
|
||||
|
|
@ -357,7 +393,6 @@ main(int argc, char** argv)
|
|||
unsigned trials = MAX_TRIALS;
|
||||
bool ignore;
|
||||
const spot::ltl::formula* f = 0;
|
||||
spot::srand(opt_seed++);
|
||||
do
|
||||
{
|
||||
ignore = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue