Types versus sets (and what about categories?)
This is an interesting article, but doesn&#x27;t give a good definition which distinguishes sets from (mathematical) types, though it hints at it with &quot;types are syntax, not semantics&quot;.<p>I suppose the main difference (paraphrasing Wikipedia [1]) is: sets are descriptive; types are constructive.  Thus, the cardinality of any given type is at most countably infinite, and thus axiom of choice is undeniably valid for types.  (Sets can be uncountably infinite, and whether the axiom of choice holds for such sets is debatable.)<p>Regarding the computer-science flavor of types, which usually (not always) overlay a value system which looks more like set theory, I suppose the difference is: sets describe concrete values, whereas types describe the <i>je-ne-sais-quoi</i> a syntactic element may require or guarantee, such that the program is well-formed.  These qualities include such ephemera as object ownership and lifetime, which can distinguish two syntactic elements in a way that sets cannot, and exclude details such as how a value of a type is represented.<p>TLA+ is an example of a language which is based on set-theory, but overlaid with a notion of types closer to this second definition.  All values in the language are sets in the set-theory sense -- TRUE, 5, &quot;Hello&quot; are all sets -- but it&#x27;s considered &quot;silly&quot; (Lamport&#x27;s term) to mix these values in a way which would belie this underlying representation.  Some tools thus perform type-checking, despite that the value language itself is untyped.  Similarly, there are different &quot;levels&quot; of expressions and rules regarding how such expressions are linked in terms of these levels, which are not captured by either syntax or values, but rather by a type system of sorts.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Type_theory#Differences_from_set_theory" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Type_theory#Differences_from_s...</a>