Types vs sets [006Y]

There is something quite subtle going on with the distinction between sets and types. In math, \mathbb {N} and \{1,2,3\} are both sets, but in Disco, \mathbb {N} is a type and \{1,2,3\} is a set. In a math context, it makes sense to say \{1,2,3\} \subseteq \mathbb {N}, but in Disco this is a syntax error!

Part of the difference is explained by the fact that Disco only supports finite sets. If infinite sets were allowed, Disco's implementation of sets would have to be much more complicated, and it would in general be difficult to know whether a given expression involving sets will run forever or not.

Another part of the difference lies in the distinction between type theory and set theory. Disco does not take sets as primitive, but starts with a collection of primitive types, corresponding to collections of objects with particularly nice closure properties—such as the natural numbers, which we know are closed under addition and multiplication. Finite sets are then something we can carve out of these existing primitive collections.