{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- return d_type->isSort();
+ return d_type->isUninterpretedSort();
////////
CVC5_API_TRY_CATCH_END;
}
{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- return d_type->isSortConstructor();
+ return d_type->isUninterpretedSortConstructor();
////////
CVC5_API_TRY_CATCH_END;
}
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_CHECK_NOT_NULL;
CVC5_API_CHECK_DOMAIN_SORTS(params);
- CVC5_API_CHECK(d_type->isParametricDatatype() || d_type->isSortConstructor())
+ CVC5_API_CHECK(d_type->isParametricDatatype()
+ || d_type->isUninterpretedSortConstructor())
<< "Expected parametric datatype or sort constructor sort.";
CVC5_API_CHECK(!d_type->isParametricDatatype()
|| d_type->getNumChildren() == params.size() + 1)
<< "Arity mismatch for instantiated parametric datatype";
- CVC5_API_CHECK(!d_type->isSortConstructor()
- || d_type->getSortConstructorArity() == params.size())
+ CVC5_API_CHECK(!d_type->isUninterpretedSortConstructor()
+ || d_type->getUninterpretedSortConstructorArity()
+ == params.size())
<< "Arity mismatch for instantiated sort constructor";
//////// all checks before this line
std::vector<internal::TypeNode> tparams = sortVectorToTypeNodes(params);
{
return Sort(d_solver, d_type->instantiateParametricDatatype(tparams));
}
- Assert(d_type->isSortConstructor());
+ Assert(d_type->isUninterpretedSortConstructor());
return Sort(d_solver, d_solver->getNodeManager()->mkSort(*d_type, tparams));
////////
CVC5_API_TRY_CATCH_END;
{
CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_CHECK_NOT_NULL;
- CVC5_API_CHECK(d_type->isSortConstructor()) << "Not a sort constructor sort.";
+ CVC5_API_CHECK(d_type->isUninterpretedSortConstructor())
+ << "Not a sort constructor sort.";
//////// all checks before this line
- return d_type->getSortConstructorArity();
+ return d_type->getUninterpretedSortConstructorArity();
////////
CVC5_API_TRY_CATCH_END;
}
const Integer& ub)
: d_type(new TypeNode(type)), d_ubound(ub)
{
- AlwaysAssert(type.isSort())
+ AlwaysAssert(type.isUninterpretedSort())
<< "Unexpected cardinality constraints for " << type;
}
TypeNode tc = d_constructors[0]->getArgType(i);
// if it is an uninterpreted sort, then we depend on it having cardinality
// one
- if (tc.isSort())
+ if (tc.isUninterpretedSort())
{
if (std::find(u_assume.begin(), u_assume.end(), tc) == u_assume.end())
{
{
for (size_t i = 0, nargs = getNumArgs(); i < nargs; i++)
{
- if (!getArgType(i).isSort())
+ if (!getArgType(i).isUninterpretedSort())
{
return true;
}
}
for (size_t i = 0, psize = paramTypes.size(); i < psize; ++i)
{
- if (paramTypes[i].getSortConstructorArity() == origChildren.size())
+ if (paramTypes[i].getUninterpretedSortConstructorArity()
+ == origChildren.size())
{
TypeNode tn = paramTypes[i].instantiateSortConstructor(origChildren);
if (range == tn)
// unresolved SortType used as a placeholder in complex types)
// with "(*resolver).second" (the TypeNode we created in the
// first step, above).
- if (ut.isSort())
+ if (ut.isUninterpretedSort())
{
placeholders.push_back(ut);
replacements.push_back((*resolver).second);
}
else
{
- Assert(ut.isSortConstructor());
+ Assert(ut.isUninterpretedSortConstructor());
paramTypes.push_back(ut);
paramReplacements.push_back((*resolver).second);
}
"expected parametric datatype");
return p.second.instantiate(params);
}
- bool isSortConstructor = p.second.isUninterpretedSortConstructor();
+ bool isUninterpretedSortConstructor =
+ p.second.isUninterpretedSortConstructor();
if (TraceIsOn("sort"))
{
Trace("sort") << "instantiating using a sort "
- << (isSortConstructor ? "constructor" : "substitution")
+ << (isUninterpretedSortConstructor ? "constructor"
+ : "substitution")
<< std::endl;
Trace("sort") << "have formals [";
copy(p.first.begin(),
<< "type ctor " << name << std::endl
<< "type is " << p.second << std::endl;
}
- cvc5::Sort instantiation = isSortConstructor
- ? p.second.instantiate(params)
- : p.second.substitute(p.first, params);
-
+ cvc5::Sort instantiation = isUninterpretedSortConstructor
+ ? p.second.instantiate(params)
+ : p.second.substitute(p.first, params);
Trace("sort") << "instance is " << instantiation << std::endl;
return instantiation;
getAttribute(TypeCardinalityClassAttr()));
}
CardinalityClass ret = CardinalityClass::INFINITE;
- if (isSort())
+ if (isUninterpretedSort())
{
ret = CardinalityClass::INTERPRETED_ONE;
}
if (!getAttribute(IsClosedEnumerableComputedAttr()))
{
bool ret = true;
- if (isArray() || isSort() || isCodatatype() || isFunction() || isRegExp())
+ if (isArray() || isUninterpretedSort() || isCodatatype() || isFunction()
+ || isRegExp())
{
ret = false;
}
bool TypeNode::isInstantiated() const
{
return isInstantiatedDatatype()
- || (isSort() && getNumChildren() > 0);
+ || (isUninterpretedSort() && getNumChildren() > 0);
}
TypeNode TypeNode::instantiateParametricDatatype(
return nm->mkTypeNode(kind::PARAMETRIC_DATATYPE, paramsNodes);
}
-uint64_t TypeNode::getSortConstructorArity() const
+uint64_t TypeNode::getUninterpretedSortConstructorArity() const
{
- Assert(isSortConstructor() && hasAttribute(expr::SortArityAttr()));
+ Assert(isUninterpretedSortConstructor()
+ && hasAttribute(expr::SortArityAttr()));
return getAttribute(expr::SortArityAttr());
}
std::string TypeNode::getName() const
{
- Assert(isSort() || isSortConstructor());
+ Assert(isUninterpretedSort() || isUninterpretedSortConstructor());
return getAttribute(expr::VarNameAttr());
}
TypeNode TypeNode::instantiateSortConstructor(
const std::vector<TypeNode>& params) const
{
- Assert(isSortConstructor());
+ Assert(isUninterpretedSortConstructor());
return NodeManager::currentNM()->mkSort(*this, params);
}
}
/** Is this a sort kind */
-bool TypeNode::isSort() const {
+bool TypeNode::isUninterpretedSort() const
+{
return ( getKind() == kind::SORT_TYPE && !hasAttribute(expr::SortArityAttr()) );
}
/** Is this a sort constructor kind */
-bool TypeNode::isSortConstructor() const {
+bool TypeNode::isUninterpretedSortConstructor() const
+{
return getKind() == kind::SORT_TYPE && hasAttribute(expr::SortArityAttr());
}
uint32_t getBitVectorSize() const;
/** Is this a sort kind */
- bool isSort() const;
+ bool isUninterpretedSort() const;
/** Is this a sort constructor kind */
- bool isSortConstructor() const;
+ bool isUninterpretedSortConstructor() const;
/** Get sort constructor arity */
- uint64_t getSortConstructorArity() const;
+ uint64_t getUninterpretedSortConstructorArity() const;
/**
* Get name, for uninterpreted sorts and uninterpreted sort constructors.
for (const TNode& var : vars)
{
- if (var.getType().isSort())
+ if (var.getType().isUninterpretedSort())
{
res.insert(var);
}
TypeNode tn,
const std::vector<Node>& elements) const
{
- if (!tn.isSort())
+ if (!tn.isUninterpretedSort())
{
out << "ERROR: don't know how to print non uninterpreted sort in model: "
<< tn << std::endl;
void Smt2Printer::toStreamCmdDeclareType(std::ostream& out,
TypeNode type) const
{
- Assert(type.isSort() || type.isSortConstructor());
- size_t arity = type.isSortConstructor() ? type.getSortConstructorArity() : 0;
+ Assert(type.isUninterpretedSort() || type.isUninterpretedSortConstructor());
+ size_t arity = type.isUninterpretedSortConstructor()
+ ? type.getUninterpretedSortConstructorArity()
+ : 0;
out << "(declare-sort " << type << " " << arity << ")" << std::endl;
}
std::stringstream ss;
options::ioutils::applyOutputLang(ss, Language::LANG_SMTLIB_V2_6);
tn.toStream(ss);
- if (tn.isSort() || (tn.isDatatype() && !tn.isTuple()))
+ if (tn.isUninterpretedSort() || (tn.isDatatype() && !tn.isTuple()))
{
std::stringstream sss;
sss << LfscNodeConverter::getNameForUserName(ss.str());
return;
}
processed.insert(tn);
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
os << "(declare ";
printType(os, tn);
std::vector<TypeNode> datatypeBlock;
for (const TypeNode& ctn : connectedTypes)
{
- if (ctn.isSort())
+ if (ctn.isUninterpretedSort())
{
d_printer->toStreamCmdDeclareType(out, ctn);
}
return;
}
processed.insert(tn);
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
connectedTypes.push_back(tn);
}
std::vector<Node> SolverEngine::getModelDomainElements(TypeNode tn) const
{
- Assert(tn.isSort());
+ Assert(tn.isUninterpretedSort());
TheoryModel* m = getAvailableModel("getModelDomainElements");
return m->getDomainElements(tn);
}
r = tr;
r = d_qstate.getRepresentative(r);
}else{
- if( r.getType().isSort() ){
+ if (r.getType().isUninterpretedSort())
+ {
Trace("internal-rep-warn") << "No representative for UF constant." << std::endl;
//should never happen : UF constants should never escape model
Assert(false);
bool FirstOrderModel::initializeRepresentativesForType(TypeNode tn)
{
RepSet* rs = d_model->getRepSetPtr();
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
// must ensure uninterpreted type is non-empty.
if (!rs->hasType(tn))
for( unsigned i=0; i<f[0].getNumChildren(); i++) {
if( d_bound_type[f].find( f[0][i] )==d_bound_type[f].end() ){
TypeNode tn = f[0][i].getType();
- if ((tn.isSort() && d_env.isFiniteType(tn))
+ if ((tn.isUninterpretedSort() && d_env.isFiniteType(tn))
|| d_qreg.getQuantifiersBoundInference().mayComplete(tn))
{
success = true;
return true;
}
}
- if( c[index].getType().isSort() ){
+ if (c[index].getType().isUninterpretedSort())
+ {
//for star: check if all children are defined and have generalizations
if (c[index] == st)
{ /// option fmfFmcCoverSimplify
it != rs->d_type_reps.end();
++it)
{
- if( it->first.isSort() ){
+ if (it->first.isUninterpretedSort())
+ {
Trace("fmc") << "Cardinality( " << it->first << " )" << " = " << it->second.size() << std::endl;
for( size_t a=0; a<it->second.size(); a++ ){
Node r = m->getRepresentative(it->second[a]);
else
{
TypeNode tn = n.getType();
- if( tn.isSort() && d_rep_ids.find(tn)!=d_rep_ids.end() ){
+ if (tn.isUninterpretedSort() && d_rep_ids.find(tn) != d_rep_ids.end())
+ {
if (d_rep_ids[tn].find(n)!=d_rep_ids[tn].end()) {
Trace(tr) << d_rep_ids[tn][n];
}else{
Trace(tr) << n;
}
- }else{
+ }
+ else
+ {
Trace(tr) << n;
}
}
d.addEntry(fm, mkCond(cond), d_true);
}else{
TypeNode tn = eq[0].getType();
- if( tn.isSort() ){
+ if (tn.isUninterpretedSort())
+ {
int j = fm->getVariableId(f, eq[0]);
int k = fm->getVariableId(f, eq[1]);
const RepSet* rs = fm->getRepSet();
d.addEntry( fm, mkCond(cond), d_true);
}
d.addEntry( fm, mkCondDefault(fm, f), d_false);
- }else{
+ }
+ else
+ {
d.addEntry( fm, mkCondDefault(fm, f), Node::null());
}
}
bool canHandle = true;
for( unsigned i=0; i<f[0].getNumChildren(); i++ ){
TypeNode tn = f[0][i].getType();
- if( !tn.isSort() ){
+ if (!tn.isUninterpretedSort())
+ {
if (!d_env.isFiniteType(tn))
{
if( tn.isInteger() ){
it != fm->getRepSetPtr()->d_type_reps.end();
++it)
{
- if( it->first.isSort() ){
- Trace("model-engine") << "Cardinality( " << it->first << " )" << " = " << it->second.size() << std::endl;
+ if (it->first.isUninterpretedSort())
+ {
+ Trace("model-engine") << "Cardinality( " << it->first << " )"
+ << " = " << it->second.size() << std::endl;
Trace("model-engine-debug") << " Reps : ";
for( size_t i=0; i<it->second.size(); i++ ){
Trace("model-engine-debug") << it->second[i] << " ";
return true;
}
TypeNode tn = v.getType();
- if (tn.isSort() && d_isFmf)
+ if (tn.isUninterpretedSort() && d_isFmf)
{
return true;
}
collectSygusGrammarTypesFor(t, types);
for (const TypeNode& tn : types)
{
- if (tn.isSort() || tn.isFloatingPoint())
+ if (tn.isUninterpretedSort() || tn.isFloatingPoint())
{
return false;
}
sdts[i].addConstructor(cop, dt[l].getName(), cargsCons);
}
}
- else if (types[i].isSort() || types[i].isFunction()
+ else if (types[i].isUninterpretedSort() || types[i].isFunction()
|| types[i].isRoundingMode())
{
// do nothing
bool TermUtil::containsUninterpretedConstant( Node n ) {
if (!n.hasAttribute(ContainsUConstAttribute()) ){
bool ret = false;
- if (n.getKind() == UNINTERPRETED_SORT_VALUE && n.getType().isSort())
+ if (n.getKind() == UNINTERPRETED_SORT_VALUE
+ && n.getType().isUninterpretedSort())
{
ret = true;
}
//check whether monotonic (elements can be added to tn without effecting satisfiability)
bool tn_is_monotonic = true;
- if( tn.isSort() ){
+ if (tn.isUninterpretedSort())
+ {
//TODO: use monotonicity inference
tn_is_monotonic = !logicInfo().isQuantified();
- }else{
+ }
+ else
+ {
tn_is_monotonic = tn.getCardinality().isInfinite();
}
//add a reference type for maximum occurrences of empty in a constraint
//apply sort inference to quantified variables
for( size_t i=0; i<n[0].getNumChildren(); i++ ){
TypeNode nitn = n[0][i].getType();
- if( !nitn.isSort() )
+ if (!nitn.isUninterpretedSort())
{
// If the variable is of an interpreted sort, we assume the
// the sort of the variable will stay the same sort.
// to be rewritten in the sort-inferred signature. Notice we only assign
// pref here if it is an uninterpreted sort.
if (!pref.isNull() && d_id_for_types.find(pref) == d_id_for_types.end()
- && pref.isSort())
+ && pref.isUninterpretedSort())
{
retType = pref;
}else{
}
bool SortInference::isMonotonic( TypeNode tn ) {
- Assert(tn.isSort());
+ Assert(tn.isUninterpretedSort());
return d_non_monotonic_sorts_orig.find( tn )==d_non_monotonic_sorts_orig.end();
}
std::vector<Node> TheoryModel::getDomainElements(TypeNode tn) const
{
// must be an uninterpreted sort
- Assert(tn.isSort());
+ Assert(tn.isUninterpretedSort());
std::vector<Node> elements;
const std::vector<Node>* type_refs = d_rep_set.getTypeRepsOrNull(tn);
if (type_refs == nullptr || type_refs->empty())
Cardinality TheoryModel::getCardinality(TypeNode tn) const
{
//for now, we only handle cardinalities for uninterpreted sorts
- if (!tn.isSort())
+ if (!tn.isUninterpretedSort())
{
Trace("model-getvalue-debug")
<< "Get cardinality other sort, unknown." << std::endl;
bool TheoryEngineModelBuilder::involvesUSort(TypeNode tn) const
{
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
return true;
}
{
visited[v] = true;
TypeNode tn = v.getType();
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
Trace("model-builder-debug") << "Is excluded usort value : " << v << " "
<< tn << std::endl;
// count the number of equivalence classes of sorts in finite model finding
if (options().quantifiers.finiteModelFind)
{
- if (eqct.isSort())
+ if (eqct.isUninterpretedSort())
{
eqc_usort_count[eqct]++;
}
bool isUSortFiniteRestricted = false;
if (options().quantifiers.finiteModelFind)
{
- isUSortFiniteRestricted = !t.isSort() && involvesUSort(t);
+ isUSortFiniteRestricted = !t.isUninterpretedSort() && involvesUSort(t);
}
#endif
n = itAssigner->second.getNextAssignment();
Assert(!n.isNull());
}
- else if (t.isSort() || !d_env.isFiniteType(t))
+ else if (t.isUninterpretedSort() || !d_env.isFiniteType(t))
{
// If its interpreted as infinite, we get a fresh value that does
// not occur in the model.
const CardinalityConstraint& cc =
lit.getOperator().getConst<CardinalityConstraint>();
TypeNode tn = cc.getType();
- Assert(tn.isSort());
+ Assert(tn.isUninterpretedSort());
Assert(d_rep_model[tn]);
uint32_t nCard = cc.getUpperBound().getUnsignedInt();
Trace("uf-ss-debug") << "...check cardinality constraint : " << tn
while( !eqcs_i.isFinished() ){
Node a = *eqcs_i;
TypeNode tn = a.getType();
- if( tn.isSort() ){
+ if (tn.isUninterpretedSort())
+ {
if( type_proc.find( tn )==type_proc.end() ){
std::map< TypeNode, std::vector< Node > >::iterator itel = eqc_list.find( tn );
if( itel!=eqc_list.end() ){
{
tn = n.getType();
}
- if (!tn.isSort())
+ if (!tn.isUninterpretedSort())
{
return;
}
if (it == d_rep_model.end())
{
SortModel* rm = nullptr;
- if (tn.isSort())
+ if (tn.isUninterpretedSort())
{
Trace("uf-ss-register") << "Create sort model " << tn << "." << std::endl;
rm = new SortModel(d_env, tn, d_state, d_im, this);
if (check)
{
const CardinalityConstraint& cc = n.getConst<CardinalityConstraint>();
- if (!cc.getType().isSort())
+ if (!cc.getType().isUninterpretedSort())
{
throw TypeCheckingExceptionPrivate(
n, "cardinality constraint must apply to uninterpreted sort");
const Integer& index)
: d_type(new TypeNode(type)), d_index(index)
{
- PrettyCheckArgument(type.isSort(),
+ PrettyCheckArgument(type.isUninterpretedSort(),
type,
"uninterpreted constants can only be created for "
"uninterpreted sorts, not `%s'",
ASSERT_FALSE(t.isFunction());
ASSERT_FALSE(t.isNull());
ASSERT_FALSE(t.isPredicate());
- ASSERT_FALSE(t.isSort());
+ ASSERT_FALSE(t.isUninterpretedSort());
ASSERT_EQ(t, t2);
ASSERT_NE(t, t3);
ASSERT_TRUE(t.isFunction());
ASSERT_FALSE(t.isNull());
ASSERT_TRUE(t.isPredicate());
- ASSERT_FALSE(t.isSort());
+ ASSERT_FALSE(t.isUninterpretedSort());
ASSERT_EQ(t, t2);
ASSERT_TRUE(t.isFunction());
ASSERT_FALSE(t.isNull());
ASSERT_FALSE(t.isPredicate());
- ASSERT_FALSE(t.isSort());
+ ASSERT_FALSE(t.isUninterpretedSort());
ASSERT_EQ(t, t2);
ASSERT_TRUE(t.isFunction());
ASSERT_FALSE(t.isNull());
ASSERT_FALSE(t.isPredicate());
- ASSERT_FALSE(t.isSort());
+ ASSERT_FALSE(t.isUninterpretedSort());
ASSERT_EQ(t, t2);
ASSERT_TRUE(t.isFunction());
ASSERT_FALSE(t.isNull());
ASSERT_TRUE(t.isPredicate());
- ASSERT_FALSE(t.isSort());
+ ASSERT_FALSE(t.isUninterpretedSort());
ASSERT_EQ(t, t2);