natural deduction metalanguage, practical foundations
type theory (dependent, intensional, observational type theory, homotopy type theory)
computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory
In type theory, the notion of subtypes is the analog of subsets in set theory.
In the presence of a type universe $Prop$ of propositions (alternatively denoted “$\Omega$”), the subtypes of a given $A \colon Type$ may be simply be identified with the function type from $A$ to $Prop$:
In topos-semantics, $Prop$ is interpreted as the subobject classifier and subtypes as subobjects.
Notice that with $Prop$ itself being a subtype of a type universe $Type$, the subtypes of $A$ are thus a special case of the $A$-dependent types
namely those whose fiber type over $a \colon A$ is the proposition asserting that “$a$ is contained in the subtype”.
This is equivalent to other definitions of subtypes, which one can make sense of also in the absence of a Prop-universe.
Notice here that in set theory, there are in fact two notions of subsets:
In material set theory, a subset of a set $A$ is a set $B$ with the property that for all $x$, if $x \in B$, then $x \in A$, which by the definition of power set in material set theory, is the same thing as an element $B \in \mathcal{P}(A)$.
In structural set theory, a subset of a set $A$ is a set $B$ with an injection $i \colon B \hookrightarrow A$.
In dependent type theory, a similar distinction can be made between the two notions of subtypes, resulting in material subtypes and structural subtypes.
We work with a Russell type of all propositions $\Omega$.
The power set of a type $A$ is defined as the function type from $A$ to the Russell type of all propositions $\Omega$, $\mathcal{P}(A) \coloneqq A \to \Omega$.
The power set of a type $A$ is always a set because its codomain, the Russell type of all propositions $\Omega$, is a set due to the univalence axiom or propositional extensionality.
A material subtype on $A$ is an element of the power set $B:\mathcal{P}(A)$.
The local membership relation $x \in_A B$ between elements $x:A$ and material subtypes $B:\mathcal{P}(A)$ is defined as
A structural subtype of $A$ is a type $B$ with an embedding $i:B \hookrightarrow A$. $A$ is a supertype of $B$.
material subtype | predicate | structural subtype |
---|---|---|
$B:\mathcal{P}(A)$ | $x:A \vdash x \in_A B \coloneqq B(x)$ | $\sum_{x:A} x \in_A B$ |
$\lambda x:A.B(x):\mathcal{P}(A)$ | $x:A \vdash B(x) \qquad x:A \vdash p(x):\mathrm{isProp}(B(x))$ | $\sum_{x:A} B(x)$ |
$\left(\lambda x:A.\sum_{y:B} i(y) =_A x\right):\mathcal{P}(A)$ | $x:A \vdash \sum_{y:B} i(y) =_A x$ | $B \qquad i:B \hookrightarrow A$ |
Given a type $A$, the improper material subtype on $A$ is the material subtype $\Im_A:\mathcal{P}(A)$ such that for all elements $x:A$, $x \in_A \Im_A$ is contractible.
Given a type $A$, there is a binary operation $(-)\cap(-):\mathcal{P}(A) \times \mathcal{P}(A) \to \mathcal{P}(A)$ on the power set of $A$ called the intersection, such that for all material subtypes $B:\mathcal{P}(A)$ and $C:\mathcal{P}(A)$, $B \cap C$ is defined as
for all $x:A$, where $A \wedge B \coloneqq [A \times B]$ is the disjunction of two types and $[T]$ is the propositional truncation of $T$.
Given a type $A$ and a type $I$, there is an function $\bigcap:(I \to \mathcal{P}(A)) \to \mathcal{P}(A)$ called the $I$-indexed intersection, such that for all families of material subtypes $B:I \to \mathcal{P}(A)$, $\bigcap_{i:I} B(i)$ is defined as
for all $x:A$, where
is the universal quantification of a type family and $[T]$ is the propositional truncation of $T$.
Given a type $A$, the empty material subtype on $A$ is the material subtype $\emptyset_A:\mathcal{P}(A)$ such that for all elements $x:A$, $x \in_A \emptyset_A$ is equivalent to the empty type.
Given a type $A$, there is a binary operation $(-)\cup(-):\mathcal{P}(A) \times \mathcal{P}(A) \to \mathcal{P}(A)$ on the power set of $A$ called the union, such that for all material subtypes $B:\mathcal{P}(A)$ and $C:\mathcal{P}(A)$, $B \cup C$ is defined as
for all $x:A$, where $A \vee B \coloneqq [A + B]$ is the disjunction of two types and $[T]$ is the propositional truncation of $T$.
Given a type $A$ and a type $I$, there is an function $\bigcup:(I \to \mathcal{P}(A)) \to \mathcal{P}(A)$ called the $I$-indexed union, such that for all families of material subtypes $B:I \to \mathcal{P}(A)$, $\bigcup_{i:I} B(i)$ is defined as
for all $x:A$, where
is the existential quantification of a type family and $[T]$ is the propositional truncation of $T$.
Given a type $A$, there is a binary relation $B:\mathcal{P}(A), C:\mathcal{P}(A) \vdash B \subseteq_A C$ on the power set of $A$ called the subtype inclusion relation, such that for all material subtypes $B:\mathcal{P}(A)$ and $C:\mathcal{P}(A)$, $B \subseteq_A C$ is defined as
Given a type $A$, there is a binary relation $B:\mathcal{P}(A), C:\mathcal{P}(A) \vdash \mathrm{Eq}_A(B, C)$ on the power set of $A$ called observational equality, such that for all material subtypes $B:\mathcal{P}(A)$ and $C:\mathcal{P}(A)$, $\mathrm{Eq}_{\mathcal{P}(A)}(B, C)$ is defined as
Axiom of extensionality: Given a type $A$, for all subtypes $B:\mathcal{P}(A)$ and $C:\mathcal{P}(A)$, there is an equivalence of types between $B =_{\mathcal{P}(A)} C$ and $\mathrm{Eq}_{\mathcal{P}(A)}(B, C)$.
For all $x:A$ and $B:\mathcal{P}(A)$, since $x \in_A B$ is propositions, by the introduction rules of the Russell type of all propositions, $x \in_A B:\Omega$. The univalence axiom for $\Omega$ states that $(x \in_A B) \simeq (x \in_A C)$ is equivalent to $(x \in_A B) =_\Omega (x \in_A C)$. Thus, $\mathrm{Eq}_{\mathcal{P}(A)}(B, C)$ is equivalent to $\prod_{x:A} (x \in_A B) =_\Omega (x \in_A C)$. But by function extensionality, there is an equivalence of types between $B =_{\mathcal{P}(A)} C$ and $\prod_{x:A} (x \in_A B) =_\Omega (x \in_A C)$; hence there is an equivalence of types between $B =_{\mathcal{P}(A)} C$ and $\mathrm{Eq}_{\mathcal{P}(A)}(B, C)$.
Given a type $A$, a singleton subtype on $A$ is a material subtype $S:\mathcal{P}(A)$ such that there exists a unique $x:A$ such that $x \in S$:
Given a type $T$, there is a binary function $(-) \times (-):\mathcal{P}(T) \times \mathcal{P}(T) \to \mathcal{P}(T \times T)$ called the cartesian product of subtypes, defined by
for all elements $a:T$, $b:T$ and subtypes $A:\mathcal{P}(T)$ and $B:\mathcal{P}(T)$.
Given a type $T$, $T$ is the improper structural subtype, with embedding given by the identity function on $T$.
Given a type $T$ and structural subtypes $R$ and $S$ with embeddings $i_R:R \hookrightarrow T$ and $i_S:S \hookrightarrow T$, the intersection of $R$ and $S$ is the dependent sum type
Given a type $T$, the empty type is the empty structural subtype, with embedding given by any function from the empty type to $T$.
Given a type $T$ and structural subtypes $R$ and $S$ with embeddings $i_R:R \hookrightarrow T$ and $i_S:S \hookrightarrow T$, the union of $R$ and $S$ is the pushout type
where $\pi_1$ and $\pi_2$ are the first and second projection functions for the first dependent sum type and $\pi_1'$ is the first projection function for the second dependent sum type for the intersection as defined above ($\sum_{r:R} \sum_{s:S} i_R(r) =_T i_S(s)$)
Given a type $T$ and structural subtypes $R$ and $S$ with embeddings $i_R:R \hookrightarrow T$ and $i_S:S \hookrightarrow T$, the cartesian product of $R$ and $S$ is simply the product $R \times S$. The associated embedding $i_{R \times S}:(R \times S) \hookrightarrow (T \times T)$ is defined by
for all $a:R \times S$, where $\pi_1$ and $\pi_2$ are the first and second product projection functions defined in the inference rules of the negative product type $R \times S$.
decidable subtype?
Martin Hofmann, Benjamin Pierce, Positive Subtyping, Information and Computation 126 1 (1996) 11-33 [doi:10.1006/inco.1996.0031]
(including early discussion of lenses in computer science)
Univalent Foundations Project, p. 111 of: Homotopy Type Theory – Univalent Foundations of Mathematics (2013) [web, pdf]
Egbert Rijke, §12.2 in: Introduction to Homotopy Type Theory (2019) [web, pdf, GitHub]
Martín Escardó, The subtype classifier and other classifiers, in: Introduction to Univalent Foundations of Mathematics with Agda [arXiv:1911.00580, webpage]
Felix Cherubini, Thierry Coquand, Matthias Hutzler, A Foundation for Synthetic Algebraic Geometry (2023) [arXiv:2307.00073]
(in the context of synthetic algebraic geometry)
In Agda:
Ettore Aldrovandi, Subtypes, §4 in: Propositions, Sets and Logic–Ⅱ [web]
In Lean:
Last revised on November 24, 2023 at 05:01:05. See the history of this page for a list of all contributions to it.