cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
guard_bdd.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Guard Data Structure
4
5
Author: Romain Brenguier, romain.brenguier@diffblue.com
6
7
\*******************************************************************/
8
11
12
#include "
guard_bdd.h
"
13
14
#include <
solvers/prop/bdd_expr.h
>
15
#include <
util/expr_util.h
>
16
#include <
util/invariant.h
>
17
#include <
util/std_expr.h
>
18
19
guard_bddt::guard_bddt
(
const
exprt
&e,
bdd_exprt
&
manager
)
20
:
manager
(
manager
),
bdd
(
manager
.
from_expr
(e))
21
{
22
}
23
24
guard_bddt
&
guard_bddt::operator=
(
const
guard_bddt
&other)
25
{
26
PRECONDITION
(&
manager
== &other.
manager
);
27
bdd
= other.
bdd
;
28
return
*
this
;
29
}
30
31
guard_bddt
&
guard_bddt::operator=
(
guard_bddt
&&other)
32
{
33
PRECONDITION
(&
manager
== &other.manager);
34
std::swap(
bdd
, other.bdd);
35
return
*
this
;
36
}
37
38
exprt
guard_bddt::guard_expr
(
exprt
expr)
const
39
{
40
if
(
is_true
())
41
{
42
// do nothing
43
return
expr;
44
}
45
else
46
{
47
if
(expr ==
false
)
48
{
49
return
boolean_negate
(
as_expr
());
50
}
51
else
52
{
53
return
implies_exprt
{
as_expr
(), expr};
54
}
55
}
56
}
57
58
guard_bddt
&
guard_bddt::append
(
const
guard_bddt
&
guard
)
59
{
60
bdd
=
bdd
.bdd_and(
guard
.bdd);
61
return
*
this
;
62
}
63
64
guard_bddt
&
guard_bddt::add
(
const
exprt
&expr)
65
{
66
bdd
=
bdd
.bdd_and(
manager
.from_expr(expr));
67
return
*
this
;
68
}
69
70
guard_bddt
&
operator-=
(
guard_bddt
&g1,
const
guard_bddt
&g2)
71
{
72
g1.
bdd
= g1.
bdd
.
constrain
(g2.
bdd
.
bdd_or
(g1.
bdd
));
73
return
g1;
74
}
75
76
guard_bddt
&
operator|=
(
guard_bddt
&g1,
const
guard_bddt
&g2)
77
{
78
g1.
bdd
= g1.
bdd
.
bdd_or
(g2.
bdd
);
79
return
g1;
80
}
81
82
exprt
guard_bddt::as_expr
()
const
83
{
84
return
manager
.as_expr(
bdd
);
85
}
bdd_expr.h
Conversion between exprt and miniBDD.
guard
static exprt guard(const exprt::operandst &guards, exprt cond)
Definition
c_safety_checks.cpp:69
bdd_exprt
Conversion between exprt and bbdt This encapsulate a bdd_managert, thus BDDs created with this class ...
Definition
bdd_expr.h:34
bddt::constrain
bddt constrain(const bddt &other)
Definition
bdd_cudd.h:120
bddt::bdd_or
bddt bdd_or(const bddt &other) const
Definition
bdd_cudd.h:100
exprt
Base class for all expressions.
Definition
expr.h:57
guard_bddt::is_true
bool is_true() const
Definition
guard_bdd.h:44
guard_bddt::as_expr
exprt as_expr() const
Definition
guard_bdd.cpp:82
guard_bddt::add
guard_bddt & add(const exprt &expr)
Definition
guard_bdd.cpp:64
guard_bddt::guard_bddt
guard_bddt(const exprt &e, bdd_exprt &manager)
Definition
guard_bdd.cpp:19
guard_bddt::append
guard_bddt & append(const guard_bddt &guard)
Definition
guard_bdd.cpp:58
guard_bddt::guard_expr
exprt guard_expr(exprt expr) const
Return guard => dest or a simplified variant thereof if either guard or dest are trivial.
Definition
guard_bdd.cpp:38
guard_bddt::bdd
bddt bdd
Definition
guard_bdd.h:74
guard_bddt::manager
bdd_exprt & manager
Definition
guard_bdd.h:73
guard_bddt::operator=
guard_bddt & operator=(const guard_bddt &other)
Definition
guard_bdd.cpp:24
implies_exprt
Boolean implication.
Definition
std_expr.h:2144
boolean_negate
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
Definition
expr_util.cpp:98
expr_util.h
Deprecated expression utility functions.
operator|=
guard_bddt & operator|=(guard_bddt &g1, const guard_bddt &g2)
Definition
guard_bdd.cpp:76
operator-=
guard_bddt & operator-=(guard_bddt &g1, const guard_bddt &g2)
Definition
guard_bdd.cpp:70
guard_bdd.h
Guard Data Structure Implementation using BDDs.
from_expr
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
Definition
language_util.cpp:39
invariant.h
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
std_expr.h
API to expression classes.
analyses
guard_bdd.cpp
Generated by
1.17.0