4.11 IsSubset

IsSubset( D, E )

IsSubset returns true if the domain E is a subset of the domain D and false otherwise.

E is considered a subset of D if and only if the set of elements of E is as a set a subset of the set of elements of D (see Elements and Set Functions for Sets). That is IsSubset behaves as if implemented as IsSubsetSet( Elements(D), Elements(E) ), except that it will also sometimes, but not always, work for infinite domains, and that it will usually work much faster than the above definition. Either argument may also be a proper set.

    gap> IsSubset( GaussianIntegers, [1,E(4)] );
    true
    gap> IsSubset( GaussianIntegers, Rationals );
    Error, sorry, cannot compare the infinite domains <D> and <E>
    gap> IsSubset( Group( (1,2), (1,2,3,4,5,6) ), D12 );
    true
    gap> IsSubset( D12, [ (), (1,2)(3,4)(5,6) ] );
    false 

The default function DomainOps.IsSubset checks whether both domains are infinite. If they are it signals an error. Otherwise if the E is infinite it returns false. Otherwise if D is infinite it tests if each element of E is in D (see Membership Test for Domains). Otherwise it tests whether the proper set of elements of E is a subset Set Functions for Sets).

Previous Up Top Next
Index

GAP 3.4.4
April 1997