## a very occasional diary.

 nondescript

## Extension.

This post is about set theory, which is a framework to reason about collections, elements and membership.

We start with a informal and naïve outline, which is (very loosely) based on a Godel-Bernays version of set theory. This theory is about sets (collections) which contain elements, which can in turn be sets. When a set $$X$$ contains an element $$t$$, it is written $$t\in X$$.

First, set equality has to be defined:

E0 Axiom of extensionality:
$$X = Y \equiv (t \in X \equiv t \in Y)$$
(Here $$\equiv$$ is a logical equivalence, pronounced "if and only if".) This axiom means that sets are equal if and only if they have the same elements. (In this and following formulae, free variables are implicitly universally quantified.)

Subsets are defined by $$X \subseteq Y \equiv (t\in X \Rightarrow t\in Y)$$, that is, X is a subset of Y when every element of X is also an element of Y. It's easy to check that $$X = Y \equiv (X\subseteq Y \wedge Y\subseteq X)$$, where $$\wedge$$ means "and".

Next, a way to build new sets is needed:

E1 Axiom of (extensional) comprehension:
$$t \in \{u \mid P(u)\} \equiv P(t)$$
This axiom introduces a "set-builder notation" $$\{u \mid P(u) \}$$ and states that $$\{u \mid P(u) \}$$ is exactly the set of all $$t$$ such that $$P(t)$$ holds.

Now, there is already enough machinery for two famous collections to be immediately constructed: empty set, $$\varnothing = \{t \mid false \}$$, which contains no elements, and the collection of all sets: $$U = \{t \mid true \}$$, which contains all possible elements.

With these axioms, conventional set operations can be defined:
• singleton: $$\{t\} = \{u\mid u = t\}$$, for each $$t$$ a singleton set $$\{t\}$$ can be constructed that contains $$t$$ as its only element. Note that $$t\in\{t\}$$
• union: $$X\cup Y = \{t\mid t \in X \vee t \in Y\}$$ ($$\vee$$ means "or")
• intersection: $$X\cap Y = \{t\mid t\in X \wedge t\in Y\}$$
• complement: $$\complement X = \{t \mid t \notin X\}$$
• (unordered) pair: $$\{t,u\} = \{t\}\cup\{u\}$$
• ordered pair: $$(t,u) = \{t, \{t, u\}\}$$
• power set: $$\mathfrak{P}(X) = \{t \mid t \subseteq X\}$$

From here, one can build hierarchical sets, representing all traditional mathematical structures, starting with natural numbers:

$$0 = \varnothing, 1 = \{0\}, 2 = \{0, 1\}, \ldots n + 1 = \{0, \ldots, n\}, \ldots$$

then integers, rationals, reals, &c., adding more axioms (of infinity, of foundation, of replacement, &c.) along the way.

It was discovered quite early that this system is not entirely satisfactory. First defect is that it is impossible to have elements which are not sets themselves. For example, one would like to talk about a "set of all inhabited planets in the Solar system". Elements of this set (planets) are not sets, they are called ur-elements. Unfortunately, the axiom of extensionality makes all ur-elements equal to the empty set. Note, that this indicates that the axiom of extensionality doesn't work well with sets that have very few (none) elements. This was never considered a problem, because all sets of interest to mathematics can be constructed without ur-elements.

Another, more serious drawback, arises in the area of very large sets: existence of a set $$\{t\mid t\notin t\}$$ directly leads to a contradiction known as Russel's paradox.

Among several methods to deal with this, one separates sets into two types: "smaller" collections which are continued to be called "sets" and "proper classes", which are collections so large that they cannot be a member of any collection. Axiom of comprehension is carefully modified so that set-builder never produces a collection having some class as its element. In this setup Russel's paradox becomes a theorem: $$\{t\mid t\notin t\}$$ is a proper class.

## Intention.

The axiom of extensionality states that sets are equal when they contain the same elements. What would happen, if set theory were based on a dual notion of intentional equality (which will be denoted by $$\sim$$ to tell it from extensional one), where sets are equal when they are contained in the same collections?

I0 Axiom of intensionality:
$$X \sim Y \equiv (X \in t \equiv Y\in t)$$
This looks bizarre: for any "normal" set $$X$$ a collection of all sets containing $$X$$ as element is unmanageably huge. But as a matter of fact, intentional equality is much older than extensional, it is variously known as Leibniz's law, identity of indiscernibles and, in less enlightened age, as duck typing.

There is a nice symmetry: while intensional equality myopically confuses small sets (ur-elements), extensional equality cannot tell very large collections (proper classes) from each other, because they are not members of anything and, therefore, intentionally equal.

The whole extensional theory buildup can be mirrored easily by moving things around $$\in$$ sign:

Intensional subsets: $$X \unlhd Y \equiv (X\in t \Rightarrow Y\in t)$$

I1 Axiom of intensional comprehension (incomprehension):
$$[u \mid P(u)]\in t \equiv P(t)$$

And associated operations:
• uniqum (or should it have been "s-ex-gleton?): $$[t] = [u\mid u \sim t]$$, note that $$[t]\in t$$.
• intentional union: $$X\triangledown Y = [t\mid X \in t \vee Y \in t]$$
• intentional intersection: $$X\triangle Y = [t\mid X \in t \wedge Y \in t]$$
• intentional complement: $$\Game X = [t \mid X \notin t]$$
• intentional pair: $$[t,u] = [t]\triangledown [u]$$
• intentional ordered pair: $$<t,u> = [t, [t, u]]$$
• intentional power set: $$\mathfrak{J}(X) = [t \mid X \unlhd t\}$$

What do all these things mean? In extensional world, a set is a container, where elements are stored. In intensional world, a set is a property, which other sets might or might not enjoy. If $$t$$ has property $$P$$, it is written as $$t\in P$$. In the traditional notation, $$P$$ is called a predicate and $$t\in P$$ is written as $$P(t)$$. The axiom of intentional equality claims that sets are equal when they have exactly the same properties (quite natural, right?). $$X$$ is an intentional subset of $$Y$$ when $$Y$$ has all properties of $$X$$ and perhaps some more (this looks like a nice way to express LSP). Intentional comprehension $$[u \mid P(u)]$$ is a set having exactly all properties $$t$$ for which $$P(t)$$ holds and no other properties. Intentional union of two sets is a set having properties of either and their intentional intersection is a set having properties of both, &c. Uniqum $$[P]$$ is the set that has property $$P$$ and no other properties.

Because intensional theory is a perfect dual of extensional nothing interesting is obtained by repeating extensional construction, for example, by building "intensional natural numbers" as

$$0' = U, 1' = [0'], 2' = [0', 1'], \ldots (n + 1)' = [0', \ldots, n'], \ldots$$

What is more interesting, is how intensional and extensional twins meet. With some filial affection it seems:
• by uniqum property $$[\varnothing] \in\varnothing$$, which contradicts the definition of $$\varnothing$$, also
• set $$[t\mid false]$$ is not a member of any set (perhaps it's a proper class) and set $$[t\mid true]$$ is a member of every set, which is strange;
• a set of which a singleton can be formed has very shallow intentional structure. Indeed:
 $$x \unlhd y$$ $$\equiv$$ { definition of intensional subset } $$x\in t \Rightarrow y\in t$$ $$\Rightarrow$$ { substitute $$\{x\}$$ for $$t$$} $$x\in \{x\} \Rightarrow y\in \{x\}$$ $$\equiv$$ { $$x\in \{x\}$$ is true by the singleton property, modus ponens } $$y\in \{x\}$$ $$\equiv$$ { the singleton property, again } $$x = y$$
To get rid of contradictions and to allow intensional and extensional sets to co-exist peacefully, domains on which singleton and uniqum operations are defined must be narrowed. To be continued.