13#ifndef MCRL2_PBES_TOOLS_PBESSOLVE_H
14#define MCRL2_PBES_TOOLS_PBESSOLVE_H
36 auto pos = filename.find_last_of(
'.');
37 if (pos == std::string::npos)
41 return filename.substr(pos + 1);
45 :
public parallel_tool<rewriter_tool<pbes_input_tool<input_tool>>>
55 void add_options(utilities::interface_description& desc)
override
58 desc.add_hidden_option(
"check-strategy",
59 "do a sanity check on the computed strategy",
'c');
60 desc.add_option(
"search-strategy",
61 utilities::make_enum_argument<search_strategy>(
"NAME")
63 "Leads to smaller counter examples",
66 "Use search strategy NAME:",
'z');
67 desc.add_option(
"file", utilities::make_file_argument(
"NAME"),
68 "The file containing the LPS or LTS that was used to "
69 "generate the PBES using lps2pbes -c. If this "
70 "option is set, a counter example or witness for the "
71 "encoded property will be generated. The "
72 "extension of the file should be .lps in case of an LPS "
73 "file, in all other cases it is assumed to "
76 desc.add_option(
"prune-todo-list",
"Prune the todo list periodically.");
77 desc.add_hidden_option(
"no-remove-unused-rewrite-rules",
78 "do not remove unused rewrite rules. ",
'u');
79 desc.add_option(
"evidence-file", utilities::make_file_argument(
"NAME"),
80 "The file to which the evidence is written. If not set, a "
81 "default name will be chosen.");
84 utilities::make_enum_argument<int>(
"NAME")
85 .add_value_desc(0,
"No on-the-fly solving is applied",
true)
86 .add_value_desc(1,
"Propagate solved equations using an attractor.")
87 .add_value_desc(2,
"Detect winning loops.")
88 .add_value_desc(3,
"Solve subgames using a fatal attractor.")
89 .add_value_desc(4,
"Solve subgames using the solver."),
90 "Use solve strategy NAME. Strategies 1-4 periodically apply on-the-fly "
91 "solving, which may lead to early termination.",
93 desc.add_hidden_option(
95 utilities::make_enum_argument<int>(
"STRATEGY")
96 .add_value_desc(0,
"Do not apply any optimizations.")
97 .add_value_desc(1,
"Remove self loops.")
98 .add_value_desc(2,
"Propagate solved equations using substitution.")
99 .add_value_desc(3,
"Propagate solved equations using an attractor.")
100 .add_value_desc(4,
"Detect winning loops using a fatal attractor.")
102 5,
"Solve subgames using a fatal attractor (local version).")
104 6,
"Solve subgames using a fatal attractor (original version).")
105 .add_value_desc(7,
"Solve subgames using the solver.")
106 .add_value_desc(8,
"Detect winning loops (original version)."
107 " N.B. This optimization does not work "
108 "correctly in combination with counter examples."
109 " It may also cause stack overflow."),
110 "use strategy STRATEGY (N.B. This is a developer option that overrides "
113 desc.add_hidden_option(
114 "no-replace-constants-by-variables",
115 "Do not move constant expressions to a substitution.");
116 desc.add_hidden_option(
"aggressive",
117 "Apply optimizations 4 and 5 at every iteration.");
118 desc.add_hidden_option(
"prune-todo-alternative",
119 "Use a variation of todo list pruning.");
128 !parser.has_option(
"no-replace-constants-by-variables");
130 !parser.has_option(
"no-remove-unused-rewrite-rules");
134 parser.has_option(
"prune-todo-alternative");
142 if (parser.has_option(
"file"))
144 std::string filename = parser.option_argument(
"file");
155 if (parser.has_option(
"evidence-file"))
157 if (!parser.has_option(
"file"))
160 "Option --evidence-file cannot be used without option --file");
165 if (parser.has_option(
"long-strategy"))
202 "strategies less than 2."
213 return {pbes_system::pbes_format_internal()};
218 :
super(toolname,
"Wieger Wesselink",
219 "Generate a BES from a PBES and solve it. ",
220 "Solves (P)BES from INFILE. "
221 "If INFILE is not present, stdin is used. "
222 "The PBES is first instantiated into a parity game, "
223 "which is then solved using Zielonka's algorithm. "
224 "It supports the generation of a witness or counter "
225 "example for the property encoded by the PBES.")
229 template <
typename PbesInstAlgorithm>
235 timer().start(
"instantiation");
237 timer().finish(
"instantiation");
246 <<
"Warning: the PBES has no counter example information. Did you "
248 " --counter-example option when generating the PBES?"
255 lps::load_lps(lpsspec,
lpsfile);
256 lps::detail::replace_global_variables(lpsspec,
sigma);
260 timer().start(
"solving");
262 G, lpsspec, pbesspec, algorithm.equation_index());
263 timer().finish(
"solving");
264 std::cout << (result ?
"true" :
"false") << std::endl;
271 <<
"Saved " << (result ?
"witness" :
"counter example") <<
" in "
279 timer().start(
"solving");
281 timer().finish(
"solving");
282 std::cout << (result ?
"true" :
"false") << std::endl;
289 <<
"Saved " << (result ?
"witness" :
"counter example") <<
" in "
294 timer().start(
"solving");
296 timer().finish(
"solving");
297 std::cout << (result ?
"true" :
"false") << std::endl;
304 pbes_system::detail::load_pbes(input_filename());
312 sigma = pbes_system::detail::instantiate_global_variables(pbesspec);
313 pbes_system::detail::replace_global_variables(pbesspec,
sigma);
320 run_algorithm<pbesinst_structure_graph_algorithm>(algorithm, pbesspec, G,
326 run_algorithm<pbesinst_structure_graph_algorithm2>(algorithm, pbesspec, G,
Generic substitution function. The substitution is stored as a mapping of variables to expressions....
Linear process specification.
This class contains labelled transition systems in .lts format.
void save(const std::string &filename) const
Save the labelled transition system to file.
void load(const std::string &filename)
Load the labelled transition system from file.
parameterized boolean equation system
Adds an optimization to pbesinst_structure_graph.
Variant of pbesinst that will compute a structure graph for a PBES. The result will be put in the str...
const vertex_vector & all_vertices() const
Standard exception class for reporting runtime errors.
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
add your file description here.
IO routines for linear process specifications.
void normalize(pbes &x)
The function normalize brings (embedded) pbes expressions into positive normal form,...
The main namespace for the PBES library.
bool solve_structure_graph(structure_graph &G, bool check_strategy=false)
search_strategy
Search strategy when generating a BES from a PBES.
bool has_counter_example_information(const pbes &pbesspec)
Guesses if a pbes has counter example information.
std::pair< bool, lps::specification > solve_structure_graph_with_counter_example(structure_graph &G, const lps::specification &lpsspec, const pbes &p, const pbes_equation_index &p_index)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.
search_strategy exploration_strategy
std::size_t number_of_threads
bool replace_constants_by_variables
bool prune_todo_alternative
data::rewrite_strategy rewrite_strategy
bool remove_unused_rewrite_rules