mCRL2
Loading...
Searching...
No Matches
significant_variables.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9/// \file mcrl2/pbes/significant_variables.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_SIGNIFICANT_VARIABLES_H
13#define MCRL2_PBES_SIGNIFICANT_VARIABLES_H
14
15#include "mcrl2/pbes/traverser.h"
16
17namespace mcrl2::pbes_system
18{
19
20namespace detail {
21
23{
25 using super::enter;
26 using super::leave;
27 using super::apply;
28
30
31 // Push a sig set to result_stack
32 void push(const std::set<data::variable>& v)
33 {
34 result_stack.push_back(v);
35 }
36
37 // Pop the top element of result_stack and return it
39 {
40 std::set<data::variable> result = std::move(result_stack.back());
41 result_stack.pop_back();
42 return result;
43 }
44
45 // Return the top element of result_stack
47 {
48 return result_stack.back();
49 }
50
51 // Return the top element of result_stack
52 const std::set<data::variable>& top() const
53 {
54 return result_stack.back();
55 }
56
57 // Merges the two elements A1 and A2 at the top of the stack into a single
58 // stack element representing union(A1, A2)
59 void join()
60 {
61 std::set<data::variable> right = pop();
62 // left == top(), the (previously) second element on the stack.
63 top().insert(std::make_move_iterator(right.begin()), std::make_move_iterator(right.end()));
64 }
65
66 void leave(const and_& /* x */)
67 {
68 join();
69 }
70
71 void leave(const or_& /* x */)
72 {
73 join();
74 }
75
76 void leave(const imp& /* x */)
77 {
78 join();
79 }
80
81 void leave(const exists& x)
82 {
83 for (const data::variable& v: x.variables())
84 {
85 top().erase(v);
86 }
87 }
88
89 void leave(const forall& x)
90 {
91 for (const data::variable& v: x.variables())
92 {
93 top().erase(v);
94 }
95 }
96
98 {
99 push(std::set<data::variable>());
100 }
101
102 void leave(const data::data_expression& x)
103 {
104 push(data::find_free_variables(x));
105 }
106};
107
108} // namespace detail
109
110inline
112{
114 f.apply(x);
115 return f.pop();
116}
117
118} // namespace mcrl2::pbes_system
119
120#endif // MCRL2_PBES_SIGNIFICANT_VARIABLES_H
A list of aterm objects.
Definition aterm_list.h:26
A unordered_map class in which aterms can be stored.
Rewriter that operates on data expressions.
Definition rewriter.h:84
Identifier generator that stores the identifiers of the context in a set. Using the operator()() and ...
\brief A data variable
Definition variable.h:25
\brief The and operator for pbes expressions
\brief The existential quantification operator for pbes expressions
const data::variable_list & variables() const
\brief The universal quantification operator for pbes expressions
const data::variable_list & variables() const
\brief The implication operator for pbes expressions
\brief The not operator for pbes expressions
\brief The or operator for pbes expressions
propositional_variable & variable()
Returns the pbes variable of the equation.
pbes_expression & formula()
Returns the predicate formula on the right hand side of the equation.
pbes_expression & operator=(const pbes_expression &) noexcept=default
parameterized boolean equation system
Definition pbes.h:54
propositional_variable_instantiation & initial_state()
Returns the initial state.
Definition pbes.h:195
Algorithm class for the finite pbesinst algorithm.
data::enumerator_identifier_generator m_id_generator
Identifier generator for the enumerator.
std::size_t m_equation_count
The number of generated equations.
void run(pbes &pbesspec, const pbesinst_variable_map &variable_map)
Runs the algorithm.
std::string print_equation_count(std::size_t size) const
Prints a message for every 1000-th equation.
data::rewriter::strategy m_rewriter_strategy
The strategy of the data rewriter.
void compute_index_map(const std::vector< pbes_equation > &equations, const pbesinst_variable_map &variable_map, pbesinst_index_map &index_map)
Returns true if the container contains the given element.
pbesinst_finite_algorithm(data::rewriter::strategy rewriter_strategy=data::jitty)
Constructor.
\brief A propositional variable instantiation
propositional_variable_instantiation(const core::identifier_string &name, const data::data_expression_list &parameters)
Constructor.
propositional_variable_instantiation & operator=(const propositional_variable_instantiation &) noexcept=default
\brief A propositional variable declaration
propositional_variable & operator=(const propositional_variable &) noexcept=default
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:393
data_expression and_(const data_expression &x, const data_expression &y)
const data_expression & true_()
Definition consistency.h:91
std::set< data::variable > significant_variables(const pbes_expression &x)
Returns the significant variables of a pbes expression.
void remove_parameters(pbes &x, const std::set< data::variable > &to_be_removed)
Removes parameters from propositional variable instantiations in a pbes expression.
void remove_parameters(pbes &x, const std::map< core::identifier_string, std::vector< std::size_t > > &to_be_removed)
Removes parameters from propositional variable instantiations in a pbes expression.
void pbesinst_finite(pbes &p, data::rewrite_strategy rewrite_strategy, const std::string &finite_parameter_selection)
Apply finite instantiation to the given PBES.
void instantiate_global_variables(pbes &p)
Attempts to eliminate the free variables of a PBES, by substituting a constant value for them....
Definition pbes.cpp:64
bool is_normalized(const pbes &x)
Checks if a PBEs is normalized.
std::vector< propositional_variable > remove_unreachable_variables(pbes &p)
Removes equations that are not (syntactically) reachable from the initial state of a PBES.
std::string print_removed_equations(const std::vector< propositional_variable > &removed)
Print removed equations.
void normalize(pbes &x)
The function normalize brings (embedded) pbes expressions into positive normal form,...
std::ostream & print_pbes_parameter_map(std::ostream &out, const pbes_parameter_map &m)
Print a parameter map.
bool match_declaration(const std::string &text, const data::variable &d, const data::data_specification &data_spec)
Returns true if the declaration text matches with the variable d.
std::string print_removed_equations(const std::vector< propositional_variable > &removed)
void split_parameters(const PropositionalVariable &X, const pbesinst_index_map &index_map, std::vector< Parameter > &finite, std::vector< Parameter > &infinite)
Computes the subset with variables of finite sort and infinite.
pbes_parameter_map parse_pbes_parameter_map(const pbes &p, const std::string &text)
Parses parameter selection for finite pbesinst algorithm.
std::vector< data::variable > find_matching_parameters(const pbes &p, const std::string &name, const std::set< std::string > &declarations)
Find parameter declarations that match a given string.
The main namespace for the PBES library.
std::set< propositional_variable > reachable_variables(const pbes &p)
pbes_expression make_exists_(const data::variable_list &l, const pbes_expression &p)
Make an existential quantification. It checks for an empty variable list, which is not allowed.
void pbesinst_finite(pbes &p, data::rewrite_strategy rewrite_strategy, const std::string &finite_parameter_selection)
std::set< data::variable > significant_variables(const pbes_expression &x)
pbes_expression make_forall_(const data::variable_list &l, const pbes_expression &p)
Make a universal quantification. It checks for an empty variable list, which is not allowed.
std::vector< propositional_variable > remove_unreachable_variables(pbes &p)
Removes equations that are not (syntactically) reachable from the initial state of a PBES.
bool is_normalized(const T &x)
Checks if a pbes expression is normalized.
Definition normalize.h:155
An empty struct that is used to denote the absence of a substitution. Used for rewriters.
Visitor that applies a propositional variable substitution to a pbes expression.
data::data_expression make_condition(const VariableContainer &variables, const ExpressionContainer &expressions) const
Computes the condition 'for all i: variables[i] == expressions[i]'.
void apply(T &result, const propositional_variable_instantiation &x)
data::data_expression_list rewrite_container(const DataExpressionContainer &v, const data::rewriter &rewr, const data::mutable_indexed_substitution<> &sigma)
std::string print_parameters(const std::vector< data::data_expression > &finite_parameters, const std::vector< data::data_expression > &infinite_parameters) const
propositional_variable_instantiation visit_initial_state(const propositional_variable_instantiation &init)
data::data_expression_list rewrite_container(const DataExpressionContainer &v, const data::rewriter &rewr)
pbesinst_finite_builder(const DataRewriter &R, SubstitutionFunction &sigma, const pbesinst_finite_rename &rho, const data::data_specification &data_spec, const pbesinst_index_map &index_map, const pbesinst_variable_map &variable_map)
void leave(const propositional_variable_instantiation &)
Exception that is used to signal an empty parameter selection.
Function object for renaming a propositional variable instantiation.
core::identifier_string operator()(const core::identifier_string &name, const data::data_expression_list &parameters) const
Renames the propositional variable x.
std::unordered_map< propositional_variable_instantiation, core::identifier_string > m
core::identifier_string rename(const core::identifier_string &name, const data::data_expression_list &parameters) const