/* Datatypes ------------------------------------------------------- */
{cvc5::Kind::APPLY_SELECTOR, APPLY_SELECTOR},
{cvc5::Kind::APPLY_CONSTRUCTOR, APPLY_CONSTRUCTOR},
- {cvc5::Kind::APPLY_SELECTOR_TOTAL, INTERNAL_KIND},
{cvc5::Kind::APPLY_TESTER, APPLY_TESTER},
{cvc5::Kind::APPLY_UPDATER, APPLY_UPDATER},
{cvc5::Kind::DT_SIZE, DT_SIZE},
}
}
break;
- case kind::APPLY_SELECTOR_TOTAL:
case kind::PARAMETRIC_DATATYPE: break;
// separation logic
return convert(theory::uf::TheoryUfRewriter::getHoApplyForApplyUf(n));
}
else if (k == APPLY_CONSTRUCTOR || k == APPLY_SELECTOR || k == APPLY_TESTER
- || k == APPLY_SELECTOR_TOTAL || k == APPLY_UPDATER)
+ || k == APPLY_UPDATER)
{
// must convert other kinds of apply to functions, since we convert to
// HO_APPLY
// get its variable name
opName << getNameForUserNameOf(dt[index].getConstructor());
}
- else if (k == APPLY_SELECTOR || k == APPLY_SELECTOR_TOTAL)
+ else if (k == APPLY_SELECTOR)
{
- if (k == APPLY_SELECTOR_TOTAL)
- {
- ret = maybeMkSkolemFun(op, macroApply);
- }
+ ret = maybeMkSkolemFun(op, macroApply);
if (ret.isNull())
{
unsigned index = DType::indexOf(op);
{
return rewriteConstructor(in);
}
- else if (kind == kind::APPLY_SELECTOR_TOTAL || kind == kind::APPLY_SELECTOR)
+ else if (kind == kind::APPLY_SELECTOR)
{
return rewriteSelector(in);
}
RewriteResponse DatatypesRewriter::rewriteSelector(TNode in)
{
- Kind k = in.getKind();
+ Assert (in.getKind()==kind::APPLY_SELECTOR);
if (in[0].getKind() == kind::APPLY_CONSTRUCTOR)
{
// Have to be careful not to rewrite well-typed expressions
return RewriteResponse(REWRITE_DONE, in[0][selectorIndex]);
}
}
- else if (k == kind::APPLY_SELECTOR_TOTAL)
- {
- // evaluates to the first ground value of type tn.
- NodeManager* nm = NodeManager::currentNM();
- Node gt = nm->mkGroundValue(tn);
- Assert(!gt.isNull());
- if (tn.isDatatype() && !tn.isInstantiatedDatatype())
- {
- gt = NodeManager::currentNM()->mkNode(
- kind::APPLY_TYPE_ASCRIPTION,
- NodeManager::currentNM()->mkConst(AscriptionType(tn)),
- gt);
- }
- Trace("datatypes-rewrite")
- << "DatatypesRewriter::postRewrite: "
- << "Rewrite trivial selector " << in
- << " to distinguished ground term " << gt << std::endl;
- return RewriteResponse(REWRITE_DONE, gt);
- }
}
return RewriteResponse(REWRITE_DONE, in);
}
parameterized APPLY_CONSTRUCTOR APPLY_TYPE_ASCRIPTION 0: "constructor application; first parameter is the constructor, remaining parameters (if any) are parameters to the constructor"
parameterized APPLY_SELECTOR SELECTOR_TYPE 1 "selector application; parameter is a datatype term (undefined if mis-applied)"
-parameterized APPLY_SELECTOR_TOTAL [SELECTOR_TYPE] 1 "selector application; parameter is a datatype term (defined rigidly if mis-applied)"
parameterized APPLY_TESTER TESTER_TYPE 1 "tester application; first parameter is a tester, second is a datatype term"
typerule APPLY_CONSTRUCTOR ::cvc5::theory::datatypes::DatatypeConstructorTypeRule
typerule APPLY_SELECTOR ::cvc5::theory::datatypes::DatatypeSelectorTypeRule
-typerule APPLY_SELECTOR_TOTAL ::cvc5::theory::datatypes::DatatypeSelectorTypeRule
typerule APPLY_TESTER ::cvc5::theory::datatypes::DatatypeTesterTypeRule
typerule APPLY_UPDATER ::cvc5::theory::datatypes::DatatypeUpdateTypeRule
typerule APPLY_TYPE_ASCRIPTION ::cvc5::theory::datatypes::DatatypeAscriptionTypeRule
{
Trace("datatypes-prereg")
<< "TheoryDatatypes::preRegisterTerm() " << n << endl;
- // should not use APPLY_SELECTOR_TOTAL
- Assert(n.getKind() != APPLY_SELECTOR_TOTAL);
// must ensure the type is well founded and has no nested recursion if
// the option dtNestedRec is not set to true.
TypeNode tn = n.getType();
TNode n,
bool check)
{
- Assert(n.getKind() == kind::APPLY_SELECTOR
- || n.getKind() == kind::APPLY_SELECTOR_TOTAL);
+ Assert(n.getKind() == kind::APPLY_SELECTOR);
TypeNode selType = n.getOperator().getType(check);
TypeNode t = selType[0];
Assert(t.isDatatype());