Obviously the big question is whether it's wise to add these protocols. But I got curious and did a little research just on the naming question, to see if "intensional set" and "extensional set" are well-established mathematical terms for different kinds of sets. Seems like they're not.
I checked two reference works -- The Princeton Companion to Mathematics and the Encyclopedic Dictionary of Mathematics (2nd edition). I looked in their tables of contents, their indexes, and in their articles discussing set theory, and there is no mention of the idea of an "intentional set" or an "extensional set". Also, anecdotally, I did some math in grad school and never ran into the terms.
The terms "extensional" and "intensional" originate in philosophy of language and logic, where they describe different kinds of definitions, not of mathematical sets, but of any kind of object. (This Stanford Encyclopedia of Philosophy article on intensional logic is a great primer.) So the idea of an "extensional set" seems to treat how a set is defined as a property of the set itself, which is odd. For instance, here is an extensional definition of the set of the counting numbers from 1 to 3 inclusive:
But the bigger issue, I think, is that the names are misleading. The protocol names IntensionalSet
and ExtensionalSet
describe how a mathematical set might be defined. But the actual protocols themselves specify different operations required by the protocols. The problem is that the sets of operations are only very loosely related to how a set might be defined.
Basically, the functions required for IntensionalSet
represent a plain old mathematical set plus a computational complexity guarantee, and have nothing to do with intensionality per se.
But the functions required for ExtensionalSet
represent a lot of structure beyond a mathematical set: an implicit mapping between indexes and elements, an implicit ordering of the the indexes and therefor of the elements, and insertability. (Insertability itself does not guarantee extensionality, because you could still define a type which allowed inserts but was partially defined by a predicate rule, and so was not a completely extensionally-defined set.)
Since “intensional” vs “extensional” do not cleanly map to what the protocols do, I don't think these terms should figure in the protocol names at all. I think the protocol names should be chosen to describe what the protocols do. For the first protocol, I would suggest a name like MathematicalSet
or SetAlgbera
or SetProtocol
.
For the second protocol, I'd suggest something that alludes to the additional operations which have nothing to do with a mathematical set, something like CollectionSet
.
Of course, all this begs the question of whether they're worth introducing, whatever their names.