12#ifndef MCRL2_MODAL_FORMULA_NORMALIZE_H
13#define MCRL2_MODAL_FORMULA_NORMALIZE_H
15#include "mcrl2/modal_formula/negate_variables.h"
16#include "mcrl2/modal_formula/traverser.h"
23struct is_normalized_traverser:
public state_formula_traverser<is_normalized_traverser>
33 void enter(
const not_& )
39 void enter(
const minus& )
45 void enter(
const imp& )
55struct normalize_builder:
public state_formula_builder<normalize_builder>
69 normalize_builder(
bool quantitative,
bool negated)
70 : m_quantitative(quantitative),
83 result = atermpp::down_cast<T>(data::sort_bool::not_(x));
87 result = atermpp::down_cast<T>(data::sort_real::negate(x));
92 result = atermpp::down_cast<T>(x);
98 result = atermpp::down_cast<T>(m_negated ? data::sort_bool::not_(x) : x);
103 void apply(T& result,
const true_& )
116 void apply(T& result,
const false_& )
129 void apply(T& result,
const not_& x)
131 assert(!m_quantitative);
132 m_negated=!m_negated;
134 m_negated=!m_negated;
138 void apply(T& result,
const minus& x)
140 assert(m_quantitative);
141 m_negated=!m_negated;
143 m_negated=!m_negated;
147 void apply(T& result,
const and_& x)
155 make_or_(result, left, right);
159 make_and_(result, left, right);
164 void apply(T& result,
const or_& x)
172 make_and_(result, left, right);
176 make_or_(result, left, right);
181 void apply(T& result,
const plus& x)
192 throw mcrl2::runtime_error(
"Cannot negate the plus operator in quantitative modal formulas: " + pp(x) +
".");
196 make_plus(result, left, right);
201 void apply(T& result,
const imp& x)
210 void apply(T& result,
const forall& x)
225 void apply(T& result,
const exists& x)
240 void apply(T& result,
const supremum& x)
255 void apply(T& result,
const infimum& x)
270 void apply(T& result,
const sum& x)
278 void apply(T& result,
const variable& x)
282 throw mcrl2::runtime_error(std::string(
"normalize error: illegal argument ") + pp(x));
288 void apply(T& result,
const must& x)
303 void apply(T& result,
const may& x)
318 void apply(T& result,
const mu& x)
334 void apply(T& result,
const nu& x)
350 void apply(T& result,
const delay& x)
376 void apply(T& result,
const yaled& x)
409 is_normalized_traverser f;
sort_expression sort() const
Returns the sort of the data expression.
data_specification()=default
Default constructor. Generate a data specification that contains only booleans and positive numbers.
\brief An untyped parameter
Linear process specification.
\brief An untyped multi action or data application
D_ParserTables parser_tables_mcrl2
void warn_left_merge_merge(const parse_node &)
Prints a warning for each occurrence of 'x ||_ y || z' in the parse tree.
void warn_and_or(const parse_node &)
Prints a warning for each occurrence of 'x && y || z' in the parse tree.
Namespace for system defined sort bool_.
const basic_sort & bool_()
Constructor for sort expression Bool.
bool is_data_expression(const atermpp::aterm &x)
Test for a data_expression expression.
bool is_untyped_data_parameter(const atermpp::aterm &x)
The main namespace for the LPS library.
The main namespace for the Process library.
bool is_untyped_multi_action(const atermpp::aterm &x)
expression traverser that visits all sub expressions