Valuation& TheorySetsPrivate::getValuation() { return d_external.d_valuation; }
+bool TheorySetsPrivate::isEntailed(Node n, bool pol)
+{
+ return d_state.isEntailed(n, pol);
+}
+
Node TheorySetsPrivate::explain(TNode literal)
{
Debug("sets") << "TheorySetsPrivate::explain(" << literal << ")" << std::endl;
{
Debug("sets") << "TheorySetsPrivate::preRegisterTerm(" << node << ")"
<< std::endl;
+ TypeNode tn = node.getType();
+ if (tn.isSet())
+ {
+ ensureFirstClassSetType(tn);
+ }
switch (node.getKind())
{
case kind::EQUAL:
SkolemManager* sm = nm->getSkolemManager();
Node A = node[0];
TypeNode setType = A.getType();
+ ensureFirstClassSetType(setType);
TypeNode ufType = nm->mkFunctionType(setType, setType.getSetElementType());
// a Null node is used here to get a unique skolem function per set type
Node uf = sm->mkSkolemFunction(SkolemFunId::SETS_CHOOSE, ufType, Node());
}
TypeNode setType = set.getType();
+ ensureFirstClassSetType(setType);
Node boundVar = nm->mkBoundVar(setType.getSetElementType());
Node singleton = nm->mkSingleton(setType.getSetElementType(), boundVar);
Node equal = set.eqNode(singleton);
return TrustNode::mkTrustRewrite(node, exists, nullptr);
}
+void TheorySetsPrivate::ensureFirstClassSetType(TypeNode tn) const
+{
+ Assert(tn.isSet());
+ if (!tn.getSetElementType().isFirstClass())
+ {
+ std::stringstream ss;
+ ss << "Cannot handle sets of non-first class types, offending set type is "
+ << tn;
+ throw LogicException(ss.str());
+ }
+}
+
void TheorySetsPrivate::presolve() { d_state.reset(); }
} // namespace sets
/** get the valuation */
Valuation& getValuation();
+ /** Is formula n entailed to have polarity pol in the current context? */
+ bool isEntailed(Node n, bool pol);
+
private:
TheorySets& d_external;
/** The state of the sets solver at full effort */
bool isCareArg( Node n, unsigned a );
- public:
- /** Is formula n entailed to have polarity pol in the current context? */
- bool isEntailed(Node n, bool pol) { return d_state.isEntailed(n, pol); }
-
- private:
-
/** expand the definition of the choose operator */
TrustNode expandChooseOperator(const Node& node,
std::vector<SkolemLemma>& lems);
/** expand the definition of is_singleton operator */
TrustNode expandIsSingletonOperator(const Node& node);
+ /** ensure that the set type is over first class type, throw logic exception
+ * if not */
+ void ensureFirstClassSetType(TypeNode tn) const;
/** subtheory solver for the theory of relations */
std::unique_ptr<TheorySetsRels> d_rels;
/** subtheory solver for the theory of sets with cardinality */