# Lecture 4: Simple Type Theory

Teacher: Gilles Dowek

Reminder: relation

$∃R \, ∀x, z. (x, z ∈_2 R ⟺ ∃ y \, (x = z × y))$ $∃R; \, ε(\underbrace{R}_{\rlap{\text{propositional content of the prop. on the right}}}) ⟺ ∀x,y,z,n. \, (⋯)$

Recall that you don’t sets if you have functions: you can use characteristic functions:

Example:

$f: \begin{cases} 4 &⟼ 4 \text{ is even} \\ 7 &⟼ 7 \text{ is even} \end{cases}$

then:

$⊢ ε(f \, 4) \qquad (4 ∈ f)\\ ⊢ ¬ ε(f \, 7)$

# Simple Type Theory

• you have an infinite number of sorts:

• $ι$: base objects
• $o$: propositional contents (what you get by applying a predicate to a term)
• $A → B$: functions from A to B
• for each pair $A,B$, application: $α_{A,B}$ of arity $⟨A → B,A,B⟩$
• a predicate symbol (the only one) $ε$ of arity $⟨o⟩$:
• for each $t$, $x_1,…,x_n ⟼ t$
• for each $A$, ${x_1,…,x_n \; \mid \; A}$

But sufficient: combinators:

$x^A ⟼ x: A → A\\ K_{A, B} ≝ x^A, y^B ⟼ x: A → (B → A)\\ S_{A,B,C} ≝ x,y,z ⟼ (x \, z) (y \, z): (A → B → C) → (A → B) → A → C$

and then we will have axioms expressing

$α(x ↦ x, a) = a\\ α(α(x,y ↦ x, a),b) = a\\$

Similarly:

$\lbrace x \; \mid \; ∃ y \, ( x = 2 × y)\rbrace\\ \dot{∧} = \lbrace x,y \; \mid \; ε(x) ∧ ε(y)\rbrace$

and then:

$ε(αα(\dot{∧},a),b) ⟺ ε(x) ∧ ε(y)$
• proposition: the sky is blue
• propositional content: that the sky is blue
• $ε$: it_is_true(that the sky is blue)

$∀ P, \, (P ⇒ P)\\ ∀ p \, (ε(p) ⇒ ε(p))$
• season(spring)
• color (4 of them)
• you can’t build the proposition: as_many(color, season) because you can’t apply predicates to predicates

To avoid binding symbols: you replace them by an operator without bound variables applied to a function: higher-order abstract syntax

$\dot{∀}_A = \lbrace f \; \mid \; ∀x^A\, ε(\underbrace{f \, x}_{A → o})\rbrace: (A → o) → o$ $ε(\dot{∀}_A \, f) ⟶ ∀x\, ε(f \, x)$

Term $t$, there exists $u$ st

$(u \, y) ⟶^\ast t$
• $t=y$: by setting $u$ to be identity: $I ≝ S \, K \, K$

• $t=x$, $x≠y$ OR $t = c$

$u y ⟶^\ast t$

by setting $u ≝ K \, x$ or $u ≝ K \, c$

• $t= α(t_1 t_2) = (t_1 \, t_2)$:

By IH: $u_1 \, y ⟶^\ast t_1$, $u_2 \, y ⟶^\ast t_2$:

$\underbrace{S \, u_1 \, u_2}_{≝ \, u} y ⟶ (u_1 \, y) (u_2 \, y) ⟶^\ast (t_1 \, t_2) = t$

Proposition $A$: there exists $u$ such that

$ε(u) ⟶^\ast A$

By induction on $A$. For example: $A ≝ A_1 ∧ A_2$. By IH: $ε(a_1) ⟶ A_1$, $ε(a_2) ⟶ A_2$:

$ε(\dot{∧} \, a_1 \, a_2) ⟶ ε(a_1) ∧ ε(a_2)$

If $A = ε(t)$, it’s even simpler.

What’s the point? Comprehension: ex:

$A ≝ ∃y \, (x = 2 × y)\\ ε(a) ⟶^\ast A\\ b \, x ⟶^\ast a\\ ε(b \, x) ⟶^\ast ε (a) ⟶^\ast A$

so (comprehension):

$∃b ; \; (ε(b \, x) ⟺ A)$

Impredicative quantification:

$∀p \, (ε(p) ⇒ ε(p))$

At first: was avoided by Russel (to avoid paradoxes like Russel’s), but his student Ramsy reintroduced it later. Martin-Löf Type Theory: predicative, on the other hand (people in Sweden at Chalmers are very reluctant to use impredicativity).

## Models

All reduction rules of Simple type theory are valid in a $\lbrace 0, 1\rbrace$-valued model:

$\underbrace{⟦ε(\dot{⊤})⟧}_{= \hat{ε} \hat{\dot{⊤}} = id(\tilde{⊤}) = 1} = \underbrace{⟦⊤⟧}_{\tilde{⊤} = 1}$

## Mathematical theories

$x=y ⟶ \dot{∀}_{ι → o} (\overline{λ} c((c \, x) \dot{⇒} (c \, y)))$

So:

$ε(x=y) ⟶^\ast ∀c \, (ε (c \, x) ⇒ ε (c \, y))$

NB: the class $c$ is of type $ι → o$

Natural numbers:

• Peano: axioms
• Cantor: 3 = the set of all sets of cardinal 3

• modern logic (due to Frege) was invented to build Cantor numbers
• Church: Church numerals
• Von Neumann: 3 = the set $\lbrace ∅, \lbrace ∅ \rbrace, \lbrace ∅, \lbrace ∅ \rbrace\rbrace\rbrace$

Church (40’s) ⟶ his student: Henkin (50’s)

\begin{align*} ⟦∀y \, ε(α_{A, o} \, x \, y)⟧_φ &= \widetilde{∀} \lbrace ⟦ε(α_{A, o} \, x \, y)⟧_{φ, y ↦ a} \; \mid \; a ∈ ℳ_a \rbrace\\ &= \widetilde{∀} \lbrace \underbrace{\widetilde ε (⟦α_{A, o} \, x \, y⟧_{φ, y ↦ a})}_{= ⟦α_{A, o} \, x \, y⟧_{φ, y ↦ a}} \; \mid \; a ∈ ℳ_a \rbrace\\ & = \widetilde{∀} \lbrace ⟦α_{A, o} \, x⟧_{φ, y ↦ a}(\underbrace{⟦y⟧_{φ, y ↦ a}}_{= a}) \; \mid \; a ∈ ℳ_a \rbrace \\ & = \widetilde{∀} \lbrace ⟦α_{A, o}⟧_{φ, y ↦ a} (\underbrace{⟦x⟧_{φ, y ↦ a}}_{= φ(x)})(a) \; \mid \; a ∈ ℳ_a \rbrace \\ & = \widetilde{∀} \lbrace φ(x)(a) \; \mid \; a ∈ ℳ_a \rbrace \\ & = \widetilde{ε}\Big(\widetilde{∀} \lbrace φ(x)(a) \; \mid \; a ∈ ℳ_a \rbrace\Big)\\ & = ⟦ε(α_{A→o, o} \, \dot{∀}_A \, x)⟧_φ \end{align*}

$plus \; ≝ \; \overline{λ} x \overline{λ} y \, C_ι \; \overline{λ}z. N \, z \;\dot{∧}\; \Big(\overline{λ} x' \overline{λ} y' \overline{λ} z'. \dot{∀}_{ι → ι → ι → o} \, \overline{λ} r \, \big(\dot{∀}_ι \, \overline{λ} n \, (r \, 0 \, n \, n) \;\dot{∧}\; \dot{∀}_ι \, \overline{λ}p \dot{∀}_ι \, \overline{λ} q ((r \, n \, p \, q) \;\dot{⇒}\; (r \, (S n) \, p \, (S q)) \;\dot{⇒}\; (r \, x' \, y' \, z'))\big)\Big) \, x \, y \, z \\ \;\dot{∧}\; \overline{λ} w. (N \, w \,\dot{⇒}\, \Big(\overline{λ} x' \overline{λ} y' \overline{λ} z'. \dot{∀}_{ι → ι → ι → o} \, \overline{λ} r \, \big(\dot{∀}_ι \, \overline{λ} n \, (r \, 0 \, n \, n) \;\dot{∧}\; \dot{∀}_ι \, \overline{λ}p \dot{∀}_ι \, \overline{λ} q ((r \, n \, p \, q) \;\dot{⇒}\; (r \, (S n) \, p \, (S q)) \;\dot{⇒}\; (r \, x' \, y' \, z'))\big)\Big) \, x \, y \, w \,\dot{⇒}\, w =_ι z)$ $\overline{λ} x \overline{λ} y \, C_ι \; \overline{λ}z. N \, z \;\dot{∧}\; \Big(\overline{λ} x' \overline{λ} y' \overline{λ} z'. \dot{∀}_{ι → ι → ι → o} \, \overline{λ} r \, \big(\dot{∀}_ι \, \overline{λ} n \, (r \, 0 \, n \, n) \;\dot{∧}\; \dot{∀}_ι \, \overline{λ}p \dot{∀}_ι \, \overline{λ} q ((r \, n \, p \, q) \;\dot{⇒}\; (r \, (S n) \, p \, (S q)) \;\dot{⇒}\; (r \, x' \, y' \, z'))\big)\Big) \, x \, y \, z \\ \;\dot{∧}\; \overline{λ} w. (N \, w \,\dot{⇒}\, \Big(\overline{λ} x' \overline{λ} y' \overline{λ} z'. \dot{∀}_{ι → ι → ι → o} \, \overline{λ} r \, \big(\dot{∀}_ι \, \overline{λ} n \, (r \, 0 \, n \, n) \;\dot{∧}\; \dot{∀}_ι \, \overline{λ}p \dot{∀}_ι \, \overline{λ} q ((r \, n \, p \, q) \;\dot{⇒}\; (r \, (S n) \, p \, (S q)) \;\dot{⇒}\; (r \, x' \, y' \, z'))\big)\Big) \, x \, y \, w \,\dot{⇒}\, w =_ι z) \, (S \, 0) \, (S \, 0)$