39 Program& program = translationUnit.getProgram();
51 if (
auto* aggr =
dynamic_cast<Aggregator*
>(node.get())) {
52 bool containsTrue =
false;
53 bool containsFalse =
false;
56 for (
Literal* lit : aggr->getBodyLiterals()) {
67 if (containsFalse || containsTrue) {
69 VecOwn<Literal> newBody;
75 for (Literal* lit : aggr->getBodyLiterals()) {
77 if (!isA<BooleanConstraint>(lit)) {
84 if (containsTrue && isEmpty) {
85 newBody.push_back(mk<BinaryConstraint>(
92 if (containsFalse || isEmpty) {
96 newBody.push_back(mk<BinaryConstraint>(
100 replacementAggregator->setBody(std::move(newBody));
101 return replacementAggregator;
111 program.apply(update);
114 for (Relation*
rel : program.getRelations()) {
116 bool containsTrue =
false;
117 bool containsFalse =
false;
119 for (Literal* lit : clause->getBodyLiterals()) {
120 if (
auto* bc =
dynamic_cast<BooleanConstraint*
>(lit)) {
121 bc->isTrue() ? containsTrue = true : containsFalse =
true;
127 program.removeClause(clause);
128 }
else if (containsTrue) {
129 auto replacementClause = Own<Clause>(
cloneHead(clause));
132 for (Literal* lit : clause->getBodyLiterals()) {
133 if (!isA<BooleanConstraint>(lit)) {
138 program.removeClause(clause);
139 program.addClause(std::move(replacementClause));