12#ifndef MCRL2_MODAL_FORMULA_NORMALIZE_H
13#define MCRL2_MODAL_FORMULA_NORMALIZE_H
21namespace state_formulas
26struct is_normalized_traverser:
public state_formula_traverser<is_normalized_traverser>
28 typedef state_formula_traverser<is_normalized_traverser> super;
35 is_normalized_traverser()
40 void enter(
const not_& )
46 void enter(
const minus& )
52 void enter(
const imp& )
62struct normalize_builder:
public state_formula_builder<normalize_builder>
64 typedef state_formula_builder<normalize_builder> super;
76 normalize_builder(
bool quantitative,
bool negated)
77 : m_quantitative(quantitative),
82 void apply(T& result,
const data::data_expression& x)
88 if (x.sort()==data::sort_bool::bool_())
90 result = data::sort_bool::not_(x);
94 result = data::sort_real::negate(x);
104 assert(x.sort()==data::sort_bool::bool_());
105 result = m_negated ? data::sort_bool::not_(x) : x;
110 void apply(T& result,
const true_& )
123 void apply(T& result,
const false_& )
136 void apply(T& result,
const not_& x)
138 assert(!m_quantitative);
139 m_negated=!m_negated;
140 apply(result, x.operand());
141 m_negated=!m_negated;
145 void apply(T& result,
const minus& x)
147 assert(m_quantitative);
148 m_negated=!m_negated;
149 apply(result, x.operand());
150 m_negated=!m_negated;
154 void apply(T& result,
const and_& x)
157 apply(left, x.left());
158 apply(right, x.right());
170 void apply(T& result,
const or_& x)
173 apply(left, x.left());
174 apply(right, x.right());
186 void apply(T& result,
const plus& x)
189 apply(left, x.left());
190 apply(right, x.right());
196 throw mcrl2::runtime_error(
"Cannot negate the plus operator in quantitative modal formulas: " +
pp(x) +
".");
205 void apply(T& result,
const imp& x)
207 state_formula y = m_quantitative ?
214 void apply(T& result,
const forall& x)
217 apply(body, x.body());
220 state_formulas::make_exists(result, x.variables(), body);
224 state_formulas::make_forall(result, x.variables(), body);
229 void apply(T& result,
const exists& x)
232 apply(body, x.body());
235 state_formulas::make_forall(result, x.variables(), body);
239 state_formulas::make_exists(result, x.variables(), body);
244 void apply(T& result,
const supremum& x)
247 apply(body, x.body());
259 void apply(T& result,
const infimum& x)
262 apply(body, x.body());
274 void apply(T& result,
const sum& x)
277 apply(body, x.body());
278 make_sum(result, x.variables(), body);
282 void apply(T& result,
const variable& x)
292 void apply(T& result,
const must& x)
294 state_formula operand;
295 apply(operand, x.operand());
298 make_may(result, x.formula(), operand);
307 void apply(T& result,
const may& x)
309 state_formula operand;
310 apply(operand, x.operand());
317 make_may(result, x.formula(), operand);
322 void apply(T& result,
const mu& x)
324 state_formula operand;
328 make_nu(result, x.name(), x.assignments(), operand);
332 apply(operand, x.operand());
333 make_mu(result, x.name(), x.assignments(), operand);
338 void apply(T& result,
const nu& x)
340 state_formula operand;
344 make_mu(result, x.name(), x.assignments(), operand);
348 apply(operand, x.operand());
349 make_nu(result, x.name(), x.assignments(), operand);
354 void apply(T& result,
const delay& x)
367 void apply(T& result,
const delay_timed& x)
380 void apply(T& result,
const yaled& x)
393 void apply(T& result,
const yaled_timed& x)
413 is_normalized_traverser f;
424void normalize(T& x,
bool quantitative =
false,
bool negated =
false,
typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value>::type* =
nullptr)
426 normalize_builder f(quantitative, negated);
436T
normalize(
const T& x,
bool quantitative =
false,
bool negated =
false,
typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value>::type* =
nullptr)
439 normalize_builder f(quantitative, negated);
Standard exception class for reporting runtime errors.
std::string pp(const atermpp::aterm &t)
Transform an aterm to an ascii string.
const data_expression & right(const data_expression &e)
Function for projecting out argument. right from an application.
const data_expression & left(const data_expression &e)
Function for projecting out argument. left from an application.
const function_symbol & false_()
Constructor for function symbol false.
const function_symbol & not_()
Constructor for function symbol !.
void make_and_(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol &&.
const function_symbol & true_()
Constructor for function symbol true.
void make_or_(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol ||.
function_symbol minus(const sort_expression &s0, const sort_expression &s1)
void make_plus(data_expression &result, const data_expression &arg0, const data_expression &arg1)
Make an application of function symbol +.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.