bool disjoint = false;
Trace("sets-nf-debug")
<< "Try split " << o0 << " against " << o1 << std::endl;
- // split them
- for (unsigned e = 0; e < 2; e++)
+ if (!d_state.areDisequal(o0, o1))
{
- Node r1 = e == 0 ? o0 : o1;
- Node r2 = e == 0 ? o1 : o0;
- // check if their intersection exists modulo equality
- Node r1r2i = d_state.getBinaryOpTerm(SET_INTER, r1, r2);
- if (!r1r2i.isNull())
- {
- Trace("sets-nf-debug")
- << "Split term already exists, but not in cardinality "
- "graph : "
- << r1r2i << ", should be empty." << std::endl;
- // their intersection is empty (probably?)
- // e.g. these are two disjoint venn regions, proceed to next
- // pair
- Assert(d_state.areEqual(emp_set, r1r2i));
- disjoint = true;
- break;
- }
+ // Just try to make them equal. This is analogous
+ // to the STRINGS_LEN_SPLIT inference in strings.
+ d_im.split(
+ o0.eqNode(o1), InferenceId::SETS_CARD_SPLIT_EQ, 1);
+ Assert(d_im.hasSent());
+ return;
}
- if (!disjoint)
+ else
{
- // simply introduce their intersection
- Assert(o0 != o1);
- Node kca = d_treg.getProxy(o0);
- Node kcb = d_treg.getProxy(o1);
- Node intro = rewrite(nm->mkNode(SET_INTER, kca, kcb));
- Trace("sets-nf") << " Intro split : " << o0 << " against " << o1
- << ", term is " << intro << std::endl;
- intro_sets.push_back(intro);
- Assert(!d_state.hasTerm(intro));
- return;
+ // split them by introducing an intersection term, which is
+ // analogous to e.g. STRINGS_SSPLIT_VAR in strings.
+ for (unsigned e = 0; e < 2; e++)
+ {
+ Node r1 = e == 0 ? o0 : o1;
+ Node r2 = e == 0 ? o1 : o0;
+ // check if their intersection exists modulo equality
+ Node r1r2i = d_state.getBinaryOpTerm(SET_INTER, r1, r2);
+ if (!r1r2i.isNull())
+ {
+ Trace("sets-nf-debug")
+ << "Split term already exists, but not in cardinality "
+ "graph : "
+ << r1r2i << ", should be empty." << std::endl;
+ // their intersection is empty (probably?)
+ // e.g. these are two disjoint venn regions, proceed to next
+ // pair
+ Assert(d_state.areEqual(emp_set, r1r2i));
+ disjoint = true;
+ break;
+ }
+ }
+ if (!disjoint)
+ {
+ // simply introduce their intersection
+ Assert(o0 != o1);
+ Node kca = d_treg.getProxy(o0);
+ Node kcb = d_treg.getProxy(o1);
+ Node intro = rewrite(nm->mkNode(SET_INTER, kca, kcb));
+ Trace("sets-nf") << " Intro split : " << o0 << " against " << o1
+ << ", term is " << intro << std::endl;
+ intro_sets.push_back(intro);
+ Assert(!d_state.hasTerm(intro));
+ return;
+ }
}
}
}