Lecture V (§5) — Table 5.5: a table of combinators #
Following Dana Scott, Lectures on a Mathematical Theory of Computation, PRG-19
(1981), Lecture V,
Typed λ-calculus. Table 5.5 summarizes how the standard combinators are defined
by λ-notation.
In the neighbourhood-system/approximable-map framework of these lectures, each
combinator scheme is
realized as a concrete approximable map, and Scott's λ-equations become the
value equations
of those maps (proved through the projection/pairing/eval/curry/fix API of
Lecture III–IV).
| Scott's table | here | value equation |
|---|---|---|
P₀ = λx,y.x | P₀ = proj₀ | P₀⟨x,y⟩ = x |
P₁ = λx,y.y | P₁ = proj₁ | P₁⟨x,y⟩ = y |
pair = λx λy.⟨x,y⟩ | pairC = curry I | pairC x y = ⟨x,y⟩ |
diag = λx.⟨x,x⟩ | diag = ⟨I,I⟩ | diag x = ⟨x,x⟩ |
funpair = λf λg λx.⟨f x, g x⟩ | funpairC | funpairC f g x = ⟨f x, g x⟩ |
proj_i^n | base cases P₀,P₁ | (scheme; see note) |
inv_{i,j}^n | base case swapC | swapC⟨x,y⟩ = ⟨y,x⟩ |
eval = λf,x.f x | evalC = evalMap | evalC⟨f,x⟩ = f x |
curry = λg λx λy.g(x,y) | curryC = ofIso | curryC g x y = g⟨x,y⟩ |
comp = λg,f λx.g(f x) | compC = curry … | compC⟨g,f⟩ = g ∘ f |
const = λk λx.k | constC = curry proj₀ | constC k x = k |
fix = λf !x.f x | fixC = fixMap | fixC f = fix f |
A note on n-ary schemes. Scott stresses that the table entries are
schemes: n-tuple,
proj_i^n, inv_{i,j}^n are families parameterized by an arity n. The
framework models the
n-fold product by iterating the binary product prod, so the n-ary
combinators are obtained
by iterating the binary ones recorded here (P₀/P₁ are proj_0^2/proj_1^2;
pairC is the
2-tuple; swapC is inv_{0,1}^2). We give the binary base cases as concrete
maps.
All combinators are data; the genuinely first-order ones (P₀, P₁, pairC,
diag,
funpairC, swapC, evalC, constC, compC) are choice-free
(#print axioms ⊆ {propext, Quot.sound}). curryC and fixC are built from the
established
ofIso/fixMap API.
Table 5.5 (Scott 1981, PRG-19). P₀ = λx,y.x, the first projection 𝒟₀ × 𝒟₁ → 𝒟₀.
Equations
- Domain.Neighborhood.P₀ V₀ V₁ = Domain.Neighborhood.proj₀ V₀ V₁
Instances For
Table 5.5 (Scott 1981, PRG-19). P₁ = λx,y.y, the second projection 𝒟₀ × 𝒟₁ → 𝒟₁.
Equations
- Domain.Neighborhood.P₁ V₀ V₁ = Domain.Neighborhood.proj₁ V₀ V₁
Instances For
Table 5.5 (Scott 1981, PRG-19). pair = λx λy.⟨x,y⟩, as the curried map
𝒟₀ → (𝒟₁ → 𝒟₀ × 𝒟₁).
Equations
Instances For
diag = λx.⟨x,x⟩ — the diagonal. #
Table 5.5 (Scott 1981, PRG-19). diag = λx.⟨x,x⟩, the diagonal 𝒟 → 𝒟 × 𝒟.
Equations
Instances For
inv = λx,y.⟨y,x⟩ — the binary argument swap (base case of #
inv_{i,j}^n).
Table 5.5 (Scott 1981, PRG-19). The base case inv_{0,1}^2 = λx,y.⟨y,x⟩
of the
argument-swap scheme: 𝒟₀ × 𝒟₁ → 𝒟₁ × 𝒟₀.
Equations
- Domain.Neighborhood.swapC V₀ V₁ = Domain.Neighborhood.paired (Domain.Neighborhood.proj₁ V₀ V₁) (Domain.Neighborhood.proj₀ V₀ V₁)
Instances For
Table 5.5 (Scott 1981, PRG-19). eval = λf,x.f(x), evaluation (𝒟₀ → 𝒟₁) × 𝒟₀ → 𝒟₁
(this is Theorem 3.11's evalMap).
Equations
- Domain.Neighborhood.evalC V₀ V₁ = Domain.Neighborhood.evalMap V₀ V₁
Instances For
Table 5.5 (Scott 1981, PRG-19). const = λk λx.k, sending k ∈ |𝒟₁| to
the constant map
𝒟₀ → 𝒟₁. Realized as curry(p₀).
Equations
Instances For
const(k) is the constant map constMap of Lemma 3.6.
curry = λg λx λy.g(x,y) — currying as a combinator. #
The order-isomorphism |𝒟₀ × 𝒟₁ → 𝒟₂| ≃o |𝒟₀ → (𝒟₁ → 𝒟₂)| between the
function-space
domains, obtained from Theorem 3.10 (funSpaceEquiv) and Theorem 3.12
(curryEquiv).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Table 5.5 (Scott 1981, PRG-19). curry = λg λx λy.g(x,y) as an
approximable map
(𝒟₀ × 𝒟₁ → 𝒟₂) → (𝒟₀ → (𝒟₁ → 𝒟₂)).
Equations
Instances For
curry(g) is the curried map of Theorem 3.12.
comp = λg,f λx.g(f x) — composition as a combinator. #
The uncurried (g, f), x ↦ g(f(x)) over ((𝒟₁→𝒟₂) × (𝒟₀→𝒟₁)) × 𝒟₀ → 𝒟₂,
built purely from
projections, pairing and eval (this is the variable-free expression Scott
alludes to).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Table 5.5 (Scott 1981, PRG-19). comp = λg,f λx.g(f(x)) as an
approximable map
((𝒟₁→𝒟₂) × (𝒟₀→𝒟₁)) → (𝒟₀ → 𝒟₂).
Equations
- Domain.Neighborhood.compC V₀ V₁ V₂ = Domain.Neighborhood.curry (Domain.Neighborhood.compMapTbl V₀ V₁ V₂)
Instances For
comp(g, f) = g ∘ f (Scott's infix g ∘ f).
funpair = λf λg λx.⟨f x, g x⟩. #
The uncurried (f, g), x ↦ ⟨f(x), g(x)⟩ over ((𝒟₂→𝒟₀) × (𝒟₂→𝒟₁)) × 𝒟₂ → 𝒟₀ × 𝒟₁.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Table 5.5 (Scott 1981, PRG-19). funpair = λf λg λx.⟨f(x), g(x)⟩, the
curried operation
(𝒟₂→𝒟₀) → ((𝒟₂→𝒟₁) → (𝒟₂ → 𝒟₀ × 𝒟₁)).
Equations
Instances For
funpair(f)(g) is the paired map ⟨f, g⟩ of Definition 3.3.
Table 5.5 (Scott 1981, PRG-19). fix = λf.!x.f(x), the least fixed-point
operator
(𝒟 → 𝒟) → 𝒟 (Theorem 4.2's fixMap).
Equations
Instances For
fix(f) = f(fix(f)).