In the homotopy type theory book (https://hott.github.io/book/nightly/hott-online-1007-ga1d0d9d.pdf) "set" is defined as follows (see chapter 3):
Definition 3.1.1. A type A is a set if for all x, y : A and all p, q : x = y, we have p = q.
Can you explain this definition to a layman? What is the intuition behind it? Is this a definite describtion of what a set is?
Because "the equality for type A" is itself a type, we are naturally led to consider "the equality for type (the equality for type A)" and "the equality for type (the equality for type (the equality for type A))", etc., etc. There is a whole tower of such types.
Types for which this tower of "the equality for type (...)" gets boring at some point are interesting in their own right. Depending where that level is, you get different names. For instance:
propositions are "boring" types: all their elements are equal. The intuition behind this name is that we only care about whether a proposition is provable or not, we do not care about the proofs themselves (so it's fine to consider them all to be equal).
sets are types for which the equality type is itself a proposition: you can have different elements but, between two such elements, all the equality proofs are equal.
A few examples:
The empty type is a proposition: all its elements are equal
The datatype Bool is a set: there is not structure hiding in the proof that
true = true
orfalse = false
.The type of sets is something else: Bool for instance can be equal to itself in two different fashions (The identity and negation functions are two distinct isomorphisms between Bool and Bool, giving rise to two distinct equality proofs).