In his answer to a question that tries to treat universal and existential quantifiers as intersections and unions of sets, Andrej Bauer says:
Forget the intersections and unions. People get this idea that ∀ and ∃ are like ⋂ and ⋃, which is the sort of thing the Polish school was doing a long time ago with Boolean algebras, but it's really not the way to go (definitely not in computer science).
and then introduces the traditional type-theoretic view of universal types as (collections of certain) functions and existential types as (collections of certain) pairs.
Question: what is wrong with the set-theoretic view? (Why was socumbersome asked to forget it?)
Further details: I ask because I'm interested in set-theoretic types (see eg. [0, 1]). where types are interpreted as collections of values, and the (set-theoretic) connectives union, intersection, and sometimes even negation are available. Interpreting quantifiers like unions and intersections (as in the linked question):
$$\forall x.T \overset{def}{:=} \bigcap_{S - type} T[x := S] $$ $$\exists x.T \overset{def}{:=} \bigcup_{S - type} T[x := S] $$
seems to me to be a natural extension of that view.
One (former?) issue I am aware of is that of dealing with cardinality of $D$ because of $D \cong D \to D$. But [0] says: "Systems which wish to reason about types as sets of values and who feature function types can quickly run into a problematic circularity in the metatheory and cardinality issues. Fortunately, these issues have been thoroughly addressed in prior work[28]" (the [28] is my [1]).
I even found an old paper[2] that I think (although I cannot claim much understanding) deals with the quantifiers that way. It, however, also syntactically restricts what type definitions are valid (on page 116):
So say $\sigma$ is (formally) contractive in t iff one of the following conditions hold:
- $\sigma$ has one of the forms bool, int, $t'$ (with $t' \neq t$), $\sigma_1 \to \sigma_2$, $\sigma_1 \times \sigma_2$, or $\sigma_1 + \sigma_2$.
- $\sigma$ has one of the forms $\sigma_1 \cap \sigma_2$ or $\sigma_1 \cup \sigma_2$ with both $\sigma_1$ and $\sigma_2$ contractive in t.
- $\sigma$ has one of the forms $\forall t'.\sigma_1$, $\exists t'.\sigma_1$, or $\mu t'.\sigma_1$ with either $t' = t$ or $\sigma_1$ contractive in t.
Now we take TExp to be the set of well-formed type expressions where $\sigma$ is well formed iff one of the following conditions hold:
- $\sigma$ is bool, int, or t.
- $\sigma$ has one of the forms $\sigma_1 \to \sigma_2$, $\sigma_1 \times \sigma_2$, $\sigma_1 + \sigma_2$, $\sigma_1 \cap \sigma_2$, $\sigma_1 \cup \sigma_2$ with both $\sigma_1$ and $\sigma_2$ well-formed.
- $\sigma$ has one of the forms $\forall t.\sigma_1$ or $\exists t.\sigma_1$ with $\sigma_1$ well formed.
- $\sigma$ has the form $\mu t.\sigma_1$ with $\sigma_1$ well formed and contractive in t.
Below that it defines an interpretation function $\mathcal{T}\colon \mbox{TExp} \to \mbox{TEnv} \to \mathcal{P}(V)$, where $V$ is the space of all values (like booleans, naturals, functions of those, etc.) with the right isomorphisms.
This paper makes it harder for me to believe there is something wrong with the "set-theoretic" quantifiers, but maybe I just misunderstand something important.
- Advanced Logical Type Systems for Untyped Languages - Andrew M. Kent; link
- Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types - Alain Frisch, Giuseppe Castagna, Véronique Benzaken; link
- An ideal model for recursive polymorphic types - David MacQueen, Gordon Plotkin, Ravi Sethi; link