Skip to content

Commit 8b0f13c

Browse files
committed
Use BDDs to simplify guard expressions
1 parent 771848a commit 8b0f13c

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
@@ -8,8 +8,12 @@ Author: Daniel Kroening, [email protected]
88

99
#include <ostream>
1010

11+
#include <solvers/prop/bdd_expr.h>
12+
1113
#include "std_expr.h"
1214
#include "simplify_utils.h"
15+
#include "symbol_table.h"
16+
#include "namespace.h"
1317
#include "guard.h"
1418

1519
/*******************************************************************\
@@ -190,7 +194,11 @@ guardt &operator |= (guardt &g1, const guardt &g2)
190194
else
191195
g1=or_exprt(g1, g2);
192196

193-
// TODO: make simplify more capable and apply here
197+
symbol_tablet symbol_table;
198+
namespacet ns(symbol_table);
199+
bdd_exprt t(ns);
200+
t.from_expr(g1);
201+
g1=t.as_expr();
194202

195203
return g1;
196204
}
@@ -246,8 +254,15 @@ guardt &operator |= (guardt &g1, const guardt &g2)
246254
{
247255
}
248256
else
249-
// TODO: make simplify more capable and apply here
257+
{
250258
g1.add(or_exprt(and_expr1, and_expr2));
259+
260+
symbol_tablet symbol_table;
261+
namespacet ns(symbol_table);
262+
bdd_exprt t(ns);
263+
t.from_expr(g1);
264+
g1=t.as_expr();
265+
}
251266
}
252267

253268
return g1;

0 commit comments

Comments
 (0)