Documentation Center

  • Trial Software
  • Product Updates

Type Checking and Mathematical Properties

This library contains several objects to perform syntactical tests with testtype (see Example 1).

Some of the objects in this library depend on arguments that must be given by the user (see Example 2).

Some of the objects can be used as mathematical properties within assume and is (see Example 3).

    Note:   All other objects that are not properties cannot be used within assume and is (see Example 4).

The next tables gives an overview of all objects in this library:

Namesyntactical testis a propertyhas arguments
Type::AlgebraicConstantyesnono
Type::AnyTypeyesnono
Type::Arithmeticalyesnono
Type::Booleanyesnono
Type::Complexyesyesno
Type::Constantyesnono
Type::ConstantIdentsyesnono
Type::Equationyesnoyes
Type::Evenyesyesno
Type::Functionyesnono
Type::Imaginaryyesyesno
Type::IndepOfyesnoyes
Type::Integeryesyesno
Type::Intervalnoyesyes
Type::ListOfyesnoyes
Type::ListProductyesnoyes
Type::NegIntyesyesno
Type::NegRatyesyesno
Type::Negativeyesyesno
Type::NonNegIntyesyesno
Type::NonNegRatyesyesno
Type::NonNegativeyesyesno
Type::NonZeroyesyesno
Type::Numericyesnono
Type::Oddyesyesno
Type::PolyOfyesnoyes
Type::PosIntyesyesno
Type::PosRatyesyesno
Type::Positiveyesyesno
Type::Primeyesnono
Type::Productyesnoyes
Type::Propertyyesnono
Type::Rationalyesyesno
Type::Realyesyesno
Type::Relationyesnono
Type::Residueyesyesyes
Type::SequenceOfyesnoyes
Type::Seriesyesnoyes
Type::Setyesnono
Type::SetOfyesnoyes
Type::Singletonyesnono
Type::TableOfEntryyesnoyes
Type::TableOfIndexyesnoyes
Type::Unionyesnoyes
Type::Unknownyesnono
Type::Zeroyesyesno

Example 1

testtype performs syntactical tests:

testtype([1, 2, 3], Type::ListOf(Type::PosInt))

testtype(3 + 4*I, Type::Constant)

Example 2

Some types depends on parameters and cannot be used without parameters:

testtype([1, 2, 3], Type::ListOf)

testtype(x = 0, Type::Equation(Type::Unknown, Type::Zero))

An interval must be given with borders, otherwise it is not a property:

assume(x, Type::Interval)
Error: The second argument must be a property. [assume]
assume(x, Type::Interval(0, infinity))

Example 3

is derives mathematical properties:

assume(x > 0):
is(sqrt(x^2), Type::NonNegative)

is(-(2*x + 1) < 0)

Example 4

Type::Property and Type::Constant are not properties:

assume(x, Type::Property)
Error: The second argument must be a property. [assume]
is(x, Type::AnyType)
Error: The type of the second argument is invalid. It must be a property or a goal. [is]
Was this topic helpful?