29.2 Equality and Comparison of Domains

Equality and comparison of domains are defined as follows.

Two domains are considered equal if and only if the sets of their elements as computed by AsSSortedList (see AsSSortedList) are equal. Thus, in general = behaves as if each domain operand were replaced by its set of elements. Except that = will also sometimes, but not always, work for infinite domains, for which of course GAP cannot compute the set of elements. Note that this implies that domains with different algebraic structure may well be equal. As a special case of this, either operand of = may also be a proper set (see Sorted Lists and Sets), i.e., a sorted list without holes or duplicates (see AsSSortedList), and = will return true if and only if this proper set is equal to the set of elements of the argument that is a domain.

No general ordering of arbitrary domains via < is defined in GAP 4. This is because a well-defined < for domains or, more general, for collections, would have to be compatible with = and would need to be transitive and antisymmetric in order to be used to form ordered sets. In particular, < would have to be independent of the algebraic structure of its arguments because this holds for =, and thus there would be hardly a situation where one could implement an efficient comparison method. (Note that in the case that two domains are comparable with <, the result is in general not compatible with the set theoretical subset relation, which can be decided with IsSubset.)

[Top] [Previous] [Up] [Next] [Index]

GAP 4 manual
February 2000