Exercise 5.11 (Scott 1981, PRG-19, §5) — D^∞ as stacks; stack combinators #
Regarding D^∞ = iterSys D (Exercise 3.16) as (bottomless) stacks of elements
of D, Scott asks
for combinators with the obvious meanings
head : D^∞ → D, tail : D^∞ → D^∞, push : D × D^∞ → D^∞,
then for diag : D → D^∞ with diag(x) = ⟨x⟩ₙ (every component equal to x),
defined by the
recursion diag(x) = push(x, diag(x)), and finally a combinator
map : (D → D)^∞ × D → D^∞, map(⟨fₙ⟩, x) = ⟨fₙ(x)⟩ₙ.
We build head, tail, push from the order-isomorphism iterProdIso : D^∞ ≅ D × D^∞ of
Exercise 3.16 (so unfold = ofIso iterProdIso, fold = ofIso iterProdIso.symm),
and obtain the
stack laws
head_push:head(push(x, s)) = x,tail_push:tail(push(x, s)) = s,push_head_tail:push(head z, tail z) = z,
together with the component readings head z = z₀ and (tail z)ₙ = zₙ₊₁.
diag and map are defined as least fixed points (Theorem 4.1/4.2); for diag
we prove Scott's
emphasised property that all components equal x (component_diag), and for
map that the
n-th component is fₙ(x) (component_map).
The only classical input is what is inherited from iterProdIso / fixMap and
the project's
Element.ext machinery.
unfold : D^∞ → D × D^∞, the forward direction of iterProdIso.
Equations
Instances For
fold : D × D^∞ → D^∞, the inverse direction of iterProdIso.
Equations
Instances For
iterProdIso reads a stack as its head together with the tail sequence.
The stack combinators. #
head : D^∞ → D, the top of the stack.
Equations
Instances For
tail : D^∞ → D^∞, the stack with its top removed.
Equations
Instances For
push : D × D^∞ → D^∞, prepend an element to a stack.
Instances For
(tail z)ₙ = zₙ₊₁.
Stack law. head(push(x, s)) = x.
Stack law. tail(push(x, s)) = s.
Stack law. push(head z, tail z) = z (a stack is its top pushed onto its
tail).
diag : D → D^∞, defined as the least fixed point of s ↦ push(x, s).
Equations
Instances For
Exercise 5.11 (Scott 1981, PRG-19). The recursion diag(x) = push(x, diag(x)).
Exercise 5.11 (Scott 1981, PRG-19). Scott's emphasised property: all
components of
diag(x) equal x, i.e. diag(x) = ⟨x⟩ₙ.
The argument domain of map: a stack of functions paired with a point, (D → D)^∞ × D.
Equations
Instances For
The body of the map recursion as a two-argument map
M(W, ⟨s, x⟩) = push((head s)(x), W(tail s, x)), from which map = fix(curry M).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The map recursion operator R(W) = λ⟨s, x⟩. push((head s)(x), W(tail s, x)).
Equations
Instances For
map : (D → D)^∞ × D → D^∞, the least fixed point of mapOp.
Equations
Instances For
Exercise 5.11 (Scott 1981, PRG-19). The recursion defining map:
map(s, x) = push((head s)(x), map(tail s, x)).
Exercise 5.11 (Scott 1981, PRG-19). The n-th component of map(s, x) is
(component s n)(x),
i.e. map(⟨fₙ⟩, x) = ⟨fₙ(x)⟩ₙ.