Skip to content

Commit

Permalink
Simplify before add
Browse files Browse the repository at this point in the history
  • Loading branch information
RipplB committed Feb 25, 2024
1 parent de80e66 commit 0e22535
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ public SmtLibSolver(

@Override
public void add(Expr<BoolType> assertion) {
final var consts = ExprUtils.getConstants(assertion);
final var simplifiedAssertion = ExprUtils.simplify(assertion);
final var consts = ExprUtils.getConstants(simplifiedAssertion);
consts.removeAll(declarationStack.toCollection());
declarationStack.add(consts);

final var term = transformationManager.toTerm(assertion);
final var term = transformationManager.toTerm(simplifiedAssertion);

assertions.add(assertion);
assertions.add(simplifiedAssertion);
declareDatatypes((Collection<Type>) consts.stream().map(ConstDecl::getType).toList());
consts.stream().map(symbolTable::getDeclaration).forEach(this::issueGeneralCommand);
issueGeneralCommand(String.format("(assert %s)", term));
Expand Down

0 comments on commit 0e22535

Please sign in to comment.