Since the osets library uses ordered lists as the underlying representation of sets, at some point we have to use list primitives (car, cdr, endp, cons) to operate on sets. A problem with using these functions directly is that they do not follow the non-set convention.
The non-set convention is: set operations should treat improper
sets (i.e., non-
The primitive list functions do not follow the non-set convention. For instance:
These behaviors make it harder to reason about set operations that are written directly in terms of the list primitives. When we try to do so, we usually have to do lots of work to consider all the cases about whether the inputs are ordered, etc.
To solve lots of these problems, we introduce new set primitives that are mostly like the list primitives, except that they follow the non-set convention. These primitives are:
The general idea is that set operations should be written in terms of these set primitives instead of the list primitives, and the definitions of the set primitives should be kept disabled to avoid having to reason about the low level structure of sets.