Skip to content

Commit 0fc3854

Browse files
committed
Use BDDs to simplify guard expressions
1 parent d994055 commit 0fc3854

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/util/guard.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <ostream>
1515

16+
#include <solvers/prop/bdd_expr.h>
17+
18+
#include "namespace.h"
1619
#include "std_expr.h"
1720
#include "simplify_utils.h"
21+
#include "symbol_table.h"
1822

1923
void guardt::guard_expr(exprt &dest) const
2024
{
@@ -139,7 +143,11 @@ guardt &operator |= (guardt &g1, const guardt &g2)
139143
else
140144
g1=or_exprt(g1, g2);
141145

142-
// TODO: make simplify more capable and apply here
146+
symbol_tablet symbol_table;
147+
namespacet ns(symbol_table);
148+
bdd_exprt t(ns);
149+
t.from_expr(g1);
150+
g1=t.as_expr();
143151

144152
return g1;
145153
}
@@ -196,8 +204,15 @@ guardt &operator |= (guardt &g1, const guardt &g2)
196204
{
197205
}
198206
else
199-
// TODO: make simplify more capable and apply here
207+
{
200208
g1.add(or_exprt(and_expr1, and_expr2));
209+
210+
symbol_tablet symbol_table;
211+
namespacet ns(symbol_table);
212+
bdd_exprt t(ns);
213+
t.from_expr(g1);
214+
g1=t.as_expr();
215+
}
201216
}
202217

203218
return g1;

0 commit comments

Comments
 (0)