mCRL2
Loading...
Searching...
No Matches
join.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//
11
12#ifndef MCRL2_PBES_JOIN_H
13#define MCRL2_PBES_JOIN_H
14
16
17namespace mcrl2 {
18
19namespace pbes_system {
20
25template <typename FwdIt>
26pbes_expression join_or(FwdIt first, FwdIt last)
27{
28 return utilities::detail::join(first, last, [](const pbes_expression& x, const pbes_expression& y) { return or_(x, y); }, false_());
29}
30
35template <typename FwdIt>
36pbes_expression join_and(FwdIt first, FwdIt last)
37{
38 return utilities::detail::join(first, last, [](const pbes_expression& x, const pbes_expression& y) { return and_(x, y); }, true_());
39}
40
49inline
50std::set<pbes_expression> split_or(const pbes_expression& expr, bool split_data_expressions = false)
51{
52 using namespace accessors;
53 std::set<pbes_expression> result;
54
55 if (split_data_expressions)
56 {
57 utilities::detail::split(expr, std::insert_iterator<std::set<pbes_expression> >(result, result.begin()), is_universal_or, data_left, data_right);
58 }
59 else
60 {
61 utilities::detail::split(expr, std::insert_iterator<std::set<pbes_expression> >(result, result.begin()), is_pbes_or, left, right);
62 }
63
64 return result;
65}
66
75inline
76std::set<pbes_expression> split_and(const pbes_expression& expr, bool split_data_expressions = false)
77{
78 using namespace accessors;
79 std::set<pbes_expression> result;
80
81 if (split_data_expressions)
82 {
83 utilities::detail::split(expr, std::insert_iterator<std::set<pbes_expression> >(result, result.begin()), is_universal_and, data_left, data_right);
84 }
85 else
86 {
87 utilities::detail::split(expr, std::insert_iterator<std::set<pbes_expression> >(result, result.begin()), is_pbes_and, left, right);
88 }
89
90 return result;
91}
92
97template <typename FwdIt>
98inline pbes_expression optimized_join_or(FwdIt first, FwdIt last)
99{
100 return utilities::detail::join(first,
101 last,
102 [](const pbes_expression& arg0, const pbes_expression& arg1) -> pbes_expression
103 {
104 pbes_expression result;
105 data::optimized_or(result, arg0, arg1);
106 return result;
107 },
108 false_());
109}
110
115template <typename FwdIt>
116inline pbes_expression optimized_join_and(FwdIt first, FwdIt last)
117{
118 return utilities::detail::join(first,
119 last,
120 [](const pbes_expression& arg0, const pbes_expression& arg1) -> pbes_expression
121 {
122 pbes_expression result;
123 data::optimized_and(result, arg0, arg1);
124 return result;
125 },
126 true_());
127}
128
129} // namespace pbes_system
130
131} // namespace mcrl2
132
133#endif // MCRL2_PBES_JOIN_H
\brief The and operator for pbes expressions
\brief The or operator for pbes expressions
void optimized_or(Term &result, const Term &p, const Term &q)
Make a conjunction, and optimize if possible.
void optimized_and(Term &result, const Term &p, const Term &q)
Make a conjunction, and optimize if possible.
bool is_universal_or(const pbes_expression &t)
Test for a disjunction.
pbes_expression join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
Definition join.h:26
std::set< pbes_expression > split_and(const pbes_expression &expr, bool split_data_expressions=false)
Splits a conjunction into a sequence of operands Given a pbes expression of the form p1 && p2 && ....
Definition join.h:76
bool is_universal_and(const pbes_expression &t)
Test for a conjunction.
const pbes_expression & true_()
pbes_expression optimized_join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
Definition join.h:116
pbes_expression optimized_join_or(FwdIt first, FwdIt last)
Returns or applied to the sequence of pbes expressions [first, last)
Definition join.h:98
pbes_expression join_and(FwdIt first, FwdIt last)
Returns and applied to the sequence of pbes expressions [first, last)
Definition join.h:36
bool is_pbes_or(const pbes_expression &t)
Returns true if the term t is an or expression.
bool is_pbes_and(const pbes_expression &t)
Returns true if the term t is an and expression.
std::set< pbes_expression > split_or(const pbes_expression &expr, bool split_data_expressions=false)
Splits a disjunction into a sequence of operands Given a pbes expression of the form p1 || p2 || ....
Definition join.h:50
const pbes_expression & false_()
T join(FwdIt first, FwdIt last, BinaryOperation op, T empty_sequence_result)
Given a sequence [t1, t2, ..., tn] of elements of type T, returns op(t1, op(t2, .....
Definition join.h:55
void split(const T &t, OutputIterator i, MatchFunction match, AccessorFunction1 lhs, AccessorFunction2 rhs)
Splits a binary tree T into a sequence, and writes the result to the output range given by an output ...
Definition join.h:34
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
The class pbes_expression.