 subtype - Maple Help

subtype

test whether one type is a subtype of another Calling Sequence subtype(s, t) Parameters

 s - any Maple type t - any Maple type Description

 • A type s is said to be a subtype of a type t if for every expression $e$ the test type(e, s) evaluates to true, then the expression type(e, t) will also evaluate to true. If a type is identified with its extension, then the subtype'' relation is the relation of inclusion.
 • The subtype(s, t) function attempts to determine if the type s is a subtype of the type t.
 • If subtype can prove that s is a subtype of t, then the value true is returned. In the same manner, if subtype can prove that s is not a subtype of t, then the value false is returned. Otherwise, if it is not possible to compute whether one type is a subtype of another, the value FAIL is returned.
 In general, it is not possible to compute whether one type is a subtype of another.
 Note: Not all pairs of types are comparable. For example, the types list and set are disjoint types; no expression is both a list and a set. Thus, both subtype( 'set', 'list' ) and subtype( 'list', 'set' ) return false. Examples

 > $\mathrm{subtype}\left('\mathrm{integer}','\mathrm{rational}'\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{subtype}\left('\mathrm{polynom}','\left\{\mathrm{string},\mathrm{algebraic}\right\}'\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{subtype}\left('\mathrm{And}\left(\mathrm{name},\mathrm{algebraic}\right)','\mathrm{name}'\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{subtype}\left('\mathrm{Vector}\left(\mathrm{integer}\right)','\mathrm{Vector}\left(\mathrm{rational}\right)'\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{subtype}\left('\mathrm{specfunc}\left(\mathrm{integer},\mathrm{sin}\right)','\mathrm{typefunc}\left(\mathrm{rational},\mathrm{name}\right)'\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{subtype}\left('\left[\mathrm{integer},\mathrm{integer}\right]','\mathrm{list}\left(\mathrm{rational}\right)'\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{subtype}\left('\left[\mathrm{integer},\mathrm{integer}\right]','\left[\mathrm{anything},\mathrm{anything}\right]'\right)$
 ${\mathrm{true}}$ (7)