bool Term::isNull() const { return isNullHelper(); }
-bool Term::isConst() const
+bool Term::isValue() const
{
CVC4_API_CHECK_NOT_NULL;
return d_node->isConst();
bool isNull() const;
/**
- * Check if this is a Term representing a constant.
+ * Check if this is a Term representing a value.
*
- * @return true if a constant Term
+ * @return true if this is a Term representing a value
*/
- bool isConst() const;
+ bool isValue() const;
/**
* Return the base (element stored at all indices) of a constant array
bint hasOp() except +
Op getOp() except +
bint isNull() except +
- bint isConst() except +
+ bint isValue() except +
Term getConstArrayBase() except +
vector[Term] getConstSequenceElements() except +
Term notTerm() except +
def isNull(self):
return self.cterm.isNull()
- def isConst(self):
- return self.cterm.isConst()
+ def isValue(self):
+ return self.cterm.isValue()
def getConstArrayBase(self):
cdef Term term = Term(self.solver)
def toPythonObj(self):
'''
Converts a constant value Term to a Python object.
- Requires isConst to hold.
+ Requires isValue to hold.
Currently supports:
Boolean -- returns a Python bool
String -- returns a Python Unicode string
'''
- if not self.isConst():
+ if not self.isValue():
raise RuntimeError("Cannot call toPythonObj on a non-const Term")
string_repr = self.cterm.toString().decode()
* literals, we can use the push/pop scope. */
/* PARSER_STATE->popScope(); */
t = SOLVER->mkArraySort(t, t2);
- if(!f.isConst()) {
+ if(!f.isValue()) {
std::stringstream ss;
ss << "expected constant term inside array constant, but found "
<< "nonconstant term" << std::endl
parseError("Too many arguments to array constant.");
}
api::Term constVal = args[0];
- if (!constVal.isConst())
+ if (!constVal.isValue())
{
// To parse array constants taking reals whose values are specified by
// rationals, e.g. ((as const (Array Int Real)) (/ 1 3)), we must handle
// like 5.0 which are converted to (/ 5 1) to distinguish them from
// integer constants. We must ensure numerator and denominator are
// constant and the denominator is non-zero.
- if (constVal.getKind() == api::DIVISION && constVal[0].isConst()
- && constVal[1].isConst()
+ if (constVal.getKind() == api::DIVISION && constVal[0].isValue()
+ && constVal[1].isValue()
&& !constVal[1].getExpr().getConst<Rational>().isZero())
{
std::stringstream sdiv;
sdiv << constVal[0] << "/" << constVal[1];
constVal = d_solver->mkReal(sdiv.str());
}
- if (!constVal.isConst())
+ if (!constVal.isValue())
{
std::stringstream ss;
ss << "expected constant term inside array constant, but found "
x = solver.mkConst(intsort, 'x')
xpone = solver.mkTerm(kinds.Plus, x, one)
onepone = solver.mkTerm(kinds.Plus, one, one)
- assert not x.isConst()
- assert one.isConst()
- assert not xpone.isConst()
- assert not onepone.isConst()
+ assert not x.isValue()
+ assert one.isValue()
+ assert not xpone.isValue()
+ assert not onepone.isValue()
def test_const_sequence_elements():
solver = pycvc4.Solver()
seqsort = solver.mkSequenceSort(realsort)
s = solver.mkEmptySequence(seqsort)
- assert s.isConst()
+ assert s.isValue()
assert s.getKind() == kinds.ConstSequence
# empty sequence has zero elements
stores = solver.mkTerm(kinds.Store, stores, solver.mkReal(2), solver.mkReal(3))
stores = solver.mkTerm(kinds.Store, stores, solver.mkReal(4), solver.mkReal(5))
- assert stores.isConst()
+ assert stores.isValue()
array_dict = stores.toPythonObj()
void testTermCompare();
void testTermChildren();
void testSubstitute();
- void testIsConst();
+ void testIsValue();
void testConstArray();
void testConstSequenceElements();
TS_ASSERT_THROWS(xpx.substitute(es, rs), CVC4ApiException&);
}
-void TermBlack::testIsConst()
+void TermBlack::testIsValue()
{
Term x = d_solver.mkConst(d_solver.getIntegerSort(), "x");
Term one = d_solver.mkReal(1);
Term xpone = d_solver.mkTerm(PLUS, x, one);
Term onepone = d_solver.mkTerm(PLUS, one, one);
- TS_ASSERT(!x.isConst());
- TS_ASSERT(one.isConst());
- TS_ASSERT(!xpone.isConst());
- TS_ASSERT(!onepone.isConst());
+ TS_ASSERT(!x.isValue());
+ TS_ASSERT(one.isValue());
+ TS_ASSERT(!xpone.isValue());
+ TS_ASSERT(!onepone.isValue());
Term tnull;
- TS_ASSERT_THROWS(tnull.isConst(), CVC4ApiException&);
+ TS_ASSERT_THROWS(tnull.isValue(), CVC4ApiException&);
}
void TermBlack::testConstArray()
Term one = d_solver.mkReal(1);
Term constarr = d_solver.mkConstArray(arrsort, one);
- TS_ASSERT(!a.isConst());
- TS_ASSERT(constarr.isConst());
+ TS_ASSERT(!a.isValue());
+ TS_ASSERT(constarr.isValue());
TS_ASSERT_EQUALS(constarr.getKind(), CONST_ARRAY);
TS_ASSERT_EQUALS(constarr.getConstArrayBase(), one);
Sort seqsort = d_solver.mkSequenceSort(realsort);
Term s = d_solver.mkEmptySequence(seqsort);
- TS_ASSERT(s.isConst());
+ TS_ASSERT(s.isValue());
TS_ASSERT_EQUALS(s.getKind(), CONST_SEQUENCE);
// empty sequence has zero elements