New Foundations is consistent

8.1 Many-sorted model theory

This is loosely based off the perspective on categorical logic offered by Johnstone in Volume 2 of Sketches of an Elephant, and takes heavy inspiration from the Flypitch project.

Definition 8.1
#

A \( \Sigma \)-language consists of a map \( \operatorname {\mathsf{Functions}} : \prod _{n : \mathbb N} (\operatorname {\mathsf{Fin}}n \to \Sigma ) \to \Sigma \to \mathsf{Type}_u \) and a map \( \operatorname {\mathsf{Relations}} : \prod _{n : \mathbb N} (\operatorname {\mathsf{Fin}}n \to \Sigma ) \to \mathsf{Type}_v \).

Definition 8.2
#

Let \( \Phi : \Sigma \to \Sigma ' \). Let \( L \) be a \( \Sigma \)-language and let \( L' \) be a \( \Sigma ' \)-language. Then a \( \Phi \)-morphism of languages \( L \xrightarrow \Phi L' \) consists of a map

\[ \operatorname {\mathsf{onFunction}} : \prod _{n : \mathbb N} \prod _{A : \operatorname {\mathsf{Fin}}n \to \Sigma } \prod _{B : \Sigma } \operatorname {\mathsf{Functions}}_L(n, A, B) \to \operatorname {\mathsf{Functions}}_{L'}(\Phi \circ A, \Phi (B)) \]

and a map

\[ \operatorname {\mathsf{onRelation}} : \prod _{n : \mathbb N} \prod _{A : \operatorname {\mathsf{Fin}}n \to \Sigma } \operatorname {\mathsf{Relations}}_L(n, A) \to \operatorname {\mathsf{Functions}}_{L'}(\Phi \circ A) \]

If \( L, L' \) are \( \Sigma \)-languages, we may simply say that a morphism of languages \( L \to L' \) is a \( \operatorname {\mathsf{id}}_\Sigma \)-morphism \( L \xrightarrow {\operatorname {\mathsf{id}}_\Sigma } L' \). 1

Definition 8.3
#

Let \( L, L' \) be \( \Sigma \)-languages. We define \( L \oplus L' \) to be the \( \Sigma \)-language with

\[ \operatorname {\mathsf{Functions}}(n, A, B) = \operatorname {\mathsf{Functions}}_L(n, A, B) \oplus \operatorname {\mathsf{Functions}}_{L'}(n, A, B) \]

and

\[ \operatorname {\mathsf{Relations}}(n, A) = \operatorname {\mathsf{Relations}}_L(n, A) \oplus \operatorname {\mathsf{Relations}}_{L'}(n, A) \]

There are morphisms of languages \( L, L' \to L \oplus L' \).

Definition 8.4
#

Let \( L \) be a \( \Sigma \)-language, and let \( M : \Sigma \to \mathsf{Type}_w \). An \( L \)-structure on \( M \) consists of a map

\[ \operatorname {\mathsf{funMap}} : \prod _{n : \mathbb N} \prod _{A : \operatorname {\mathsf{Fin}}n \to \Sigma } \prod _{B : \Sigma } \operatorname {\mathsf{Functions}}(n, A, B) \to \left(\prod _{i : \operatorname {\mathsf{Fin}}n} M(A(i)) \right) \to M(B) \]

and a map

\[ \operatorname {\mathsf{relMap}} : \prod _{n : \mathbb N} \prod _{A : \operatorname {\mathsf{Fin}}n \to \Sigma } \operatorname {\mathsf{Relations}}(n, A) \to \left(\prod _{i : \operatorname {\mathsf{Fin}}n} M(A(i)) \right) \to \mathsf{Prop} \]

We will write \( f^M \) for \( \operatorname {\mathsf{funMap}}(n, A, B, f) \), and similarly \( R^M \) for \( \operatorname {\mathsf{relMap}}(n, R) \). If \( M \) is an \( L \)-structure and an \( L' \)-structure, it is also naturally an \( (L \oplus L') \)-structure. If \( M \) is an \( L \)-structure and an \( L' \)-structure, then a morphism of \( \Sigma \)-languages \( \Phi : L \to L' \) is called an expansion on \( M \) if it commutes with the interpretations of all symbols on \( M \).

Definition 8.5
#

Let \( L \) be a \( \Sigma \)-language. A morphism of \( L \)-structures \( M \to N \) consists of functions \( h_A : M_A \to N_A \) such that for all \( n : \mathbb N \), \( A : \operatorname {\mathsf{Fin}}n \to \Sigma \), and \( B : \Sigma \), all function symbols \( f : \operatorname {\mathsf{Functions}}(n, A, B) \), and all \( x : \prod _{i : \operatorname {\mathsf{Fin}}n} M(A(i)) \),

\[ h_B(f^M(x)) = f^N(i \mapsto h_{A(i)}(x(i))) \]

and for all relation symbols \( R : \operatorname {\mathsf{Relations}}(n, A) \),

\[ R^M(x) \to R^N(i \mapsto h_{A(i)}(x(i))) \]
Definition 8.6
#

Let \( L \) be a \( \Sigma \)-language, and let \( \alpha : \mathsf{Type}_{u'} \) be a sort of variables of sort \( S : \alpha \to \Sigma \). An \( L \)-term on \( \alpha : S \) of sort \( A \), the type of which is denoted \( \operatorname {\mathsf{Term}}_{\alpha :S} A \), is either

  • a variable, comprised solely of a name \( n : \alpha \) such that \( S(n) = A \), or

  • an application of a function symbol, comprised of some \( n : \mathbb N \), a map \( B : \operatorname {\mathsf{Fin}}n \to \Sigma \), a function symbol \( f : \operatorname {\mathsf{Functions}}(n, B, A) \), and terms \( t : \prod _{i : \operatorname {\mathsf{Fin}}n} \operatorname {\mathsf{Term}}_{\alpha :S} B(i) \).

Definition 8.7
#

Let \( L \) be a \( \Sigma \)-language, and let \( \alpha : \mathsf{Type}_{u'} \) and \( S : \alpha \to \Sigma \). We define the type of \( L \)-bounded formulae on \( \alpha : S \) with free variables indexed by \( \alpha \), and \( n \) additional free variables of sorts \( f : \operatorname {\mathsf{Fin}}n \to \Sigma \), denoted \( \mathsf{BForm}_{\alpha :S}^f \), by the following constructors.

  • \( \operatorname {\mathsf{falsum}} : \mathsf{BForm}_{\alpha :S}^f \);

  • \( \operatorname {\mathsf{equal}} : \prod _{A : \Sigma } \operatorname {\mathsf{Term}}_{\alpha \oplus \operatorname {\mathsf{Fin}}n : S \oplus f} A \to \operatorname {\mathsf{Term}}_{\alpha \oplus \operatorname {\mathsf{Fin}}n : S \oplus f} A \to \mathsf{BForm}_{\alpha :S}^f \);

  • \( \operatorname {\mathsf{rel}} : \prod _{m : \mathbb N} \prod _{B : \operatorname {\mathsf{Fin}}m \to \Sigma } \prod _{R : \operatorname {\mathsf{Relations}}(m, B)} \left( \prod _{i : \operatorname {\mathsf{Fin}}m} \operatorname {\mathsf{Term}}_{\alpha \oplus \operatorname {\mathsf{Fin}}n : S \oplus f} B(i) \right) \to \mathsf{BForm}_{\alpha :S}^f \);

  • \( \operatorname {\mathsf{imp}} : \mathsf{BForm}_{\alpha :S}^f \to \mathsf{BForm}_{\alpha :S}^f \to \mathsf{BForm}_{\alpha :S}^f \); and

  • \( \operatorname {\mathsf{all}} : \prod _{A : \Sigma } \mathsf{BForm}_{\alpha :S}^{A :: f} \to \mathsf{BForm}_{\alpha :S}^f \),

where the syntax \( A :: f \) denotes the cons operation on maps from \( \operatorname {\mathsf{Fin}}n \). 2 An \( L \)-formula on \( \alpha : S \) with free variables indexed by \( \alpha \) is an inhabitant of \( \mathsf{BForm}_{\alpha :S}^{\# []} \). 3 An \( L \)-sentence is an \( L \)-formula with free variables indexed by \( \operatorname {\mathsf{Empty}} : f \), where \( f \) is the unique function \( \operatorname {\mathsf{Empty}} \to \Sigma \). An \( L \)-theory is a set of \( L \)-sentences.

  1. It is crucial that \( \operatorname {\mathsf{id}}\circ f \equiv f \circ \operatorname {\mathsf{id}}\equiv f \) definitionally.
  2. This is implemented in mathlib as Fin.cons.
  3. The expression \( \# [] \) is mathlib’s syntax for the unique map \( \operatorname {\mathsf{Fin}}0 \to \Sigma \).