Exercise 6.17 (Scott 1981, PRG-19, Β§6) β the algebras for which C is initial #
EXERCISE 6.17. What are the algebras for which
Cis initial? IfAof 6.2 is a generalization ofB, what is the corresponding generalization ofC? Prove that it exists and explain what are the algebras involved.
C (Example 4.4: finite-or-infinite binary sequences) satisfies the domain
equation
C β
{{Ξ}} + C + C (Example 6.2, Example62C.lean). So C is a solution of the
domain equation for
the functor
T(X) = π + X + X (one terminator + two successor copies).
This module proves that C is the initial T-algebra: for every
T-algebra (E, k) there is a
unique homomorphism C β E. Concretely a T-algebra is a strict map `k : π + E
- E β E`, which by the universal property of the separated sum is the same data as
- a distinguished element
e β |E|(the image of the terminatorπ), and - two strict endomaps
fβ, fβ : E β E(the two successor branches);
so the algebras for which C is initial are the domains carrying a point and
two strict unary
operations, and the unique homomorphism C β E interprets a finite-or-infinite
binary sequence
bβbβbββ¦ as f_{bβ}(f_{bβ}(β¦ e β¦)).
Why a bespoke category of β
-free domains #
Scott's separated sum πβ + πβ (Exercise 3.18) is a neighbourhood system only
under the standing
assumption β
β π (an empty neighbourhood of one summand would become a spurious
consistency witness
for the other tag, breaking inter_mem). Consequently the functor T(X) = π + X + X does not
extend to a total endofunctor of the all-systems category DomainObj, and the
existence Theorem 6.14
(stated over DomainObj) cannot be instantiated directly.
Following Scott β who restricts to the category of β
-free systems and strict
maps in Exercise 6.19
β we instantiate the abstract categorical vocabulary (Definitions 6.3β6.5) on the
bespoke object type
StrictDomainObj of neighbourhood systems with no empty neighbourhood, with
strict approximable
maps as morphisms. The functor T then reuses the existing sum3 (Example 6.2,
the genuine
three-way separated sum) and a three-way sum map, and initiality of C is proved
directly (we
construct the homomorphism and prove its uniqueness by the finite-approximant
argument), rather than
routing through the colimit construction of Theorem 6.14.
Everything is choice-free where it is data; the homomorphism/uniqueness layer reuses the project's established machinery.
The category of β
-free domains and strict maps #
An object of Scott's category (Exercise 6.19): a token type, a neighbourhood
system on it,
and the
standing assumption β
β π (every neighbourhood is non-empty).
- carrier : Type w
The token type.
- sys : NeighborhoodSystem self.carrier
The neighbourhood system.
Scott's standing assumption
β β π.
Instances For
The category of β
-free domains and strict maps. Morphisms are strict
approximable maps
(StrictMap, Exercise 5.10); identities and associative composition come from
Theorem 2.5, and
strictness is preserved by isStrict_idMap / isStrict_comp.
Equations
- One or more equations did not get rendered due to their size.
Every neighbourhood of the three-way separated sum sum3 is non-empty (so
sum3 is again an
object of the β
-free category).
Membership-shape lemmas for sum3 (no nesting through the wrong tag) #
A sum3-neighbourhood contained in a 0-copy 0X is itself a 0-copy.
A sum3-neighbourhood contained in a 1-copy 1Y is itself a 1-copy.
A sum3-neighbourhood contained in a 2-copy 2Z is itself a 2-copy.
The three-way sum map fβ + fβ + fβ : πβ+πβ+πβ β πβ'+πβ'+πβ'. Routes each
tagged copy iX
through fα΅’ (to iYα΅’'), and sends everything to the codomain master. (The
three-way analogue of
Exercise 3.19's sumMap.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
The three-way sum map is always strict: (fβ+fβ+fβ)(β₯) = β₯. (The master only
relates to the
master, since master3 is not any tagged copy.)
Functoriality (identities): I + I + I = I.
Functoriality (composition): (gββfβ) + (gββfβ) + (gββfβ) = (gβ+gβ+gβ) β (fβ+fβ+fβ).
The canonical injections D_i βͺ Dβ+Dβ+Dβ #
The 0-injection Dβ βͺ Dβ+Dβ+Dβ: send xββ|Dβ| to the sum element whose
only proper
neighbourhoods are the 0-copies 0X with Xβxβ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The 1-injection Dβ βͺ Dβ+Dβ+Dβ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The 2-injection Dβ βͺ Dβ+Dβ+Dβ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Monotonicity of the injections, and the action of fβ+fβ+fβ on them #
(fβ+fβ+fβ)(injβ x) = injβ(fβ x).
(fβ+fβ+fβ)(injβ x) = injβ(fβ x).
(fβ+fβ+fβ)(injβ x) = injβ(fβ x).
The morphism action of T: T(f) = I_π + f + f (identity on the terminator,
f on each
successor copy). Always strict (isStrict_sumMap3).
Equations
Instances For
The map of an order-isomorphism is strict (an iso of domains preserves β₯).
C (Example 4.4: finite-or-infinite binary sequences) as an object of the
β
-free category.
Equations
- Domain.Neighborhood.Cobj = { carrier := Domain.Neighborhood.ExampleB.Str, sys := Domain.Neighborhood.Example44.C, nonempty := Domain.Neighborhood.Example62C.C_nonempty }
Instances For
The T-algebra structure on C. (tcObj Cobj).sys = π + C + C
(definitionally Example
6.2's
CC), and the structure map i : π + C + C β C is the inverse of the
domain-equation isomorphism
ccEquiv (Example 6.2), realised as an approximable map by ofIso; it is strict
by isStrict_ofIso.
Concretely i sends the terminator to ΞΜ and each b-copy of x to bΒ·x.
Equations
Instances For
C is a T-algebra, (C, i) with T(X) = π + X + X.
Equations
- Domain.Neighborhood.Calg = { carrier := Domain.Neighborhood.Cobj, str := Domain.Neighborhood.cStr }
Instances For
Initiality of (C, i): the unique homomorphism into any T-algebra #
We first relate the domain-equation isomorphism toCC = ccEquiv to the
separated-sum injections:
the terminator ΞΜ lands on the π-copy, and prepending a bit (consMap b)
lands on the b-th
C-copy.
(bΒ·z).mem (bX) β z.mem X: the b-successor's filter restricted to the
b-copy is z.
(bΒ·z) never meets the (Β¬b)-copy: 0z avoids the 1-copies and vice versa
(used to
discharge
the cross-tag cases in toCC_consMap).
(bΒ·z) avoids the terminator {Ξ} (since bΟ β Ξ).
toCC β (0Β·) = injβ and toCC β (1Β·) = injβ. Prepending the bit b to
z is, across the
isomorphism C β
π+C+C, the injection of z into the b-th C-summand.
toCC ΞΜ = injβ. The finished empty sequence is the terminator (the
π-summand).
The distinguished point e = k(Ξ): the image under k of the terminator
(π-injection).
Equations
Instances For
The b-th successor operation f_b = k β inj_b: fβ via the 0-copy
(injβ), fβ via the
1-copy (injβ).
Equations
- Domain.Neighborhood.descF B b y = (βB.str).toElementMap (bif b then Domain.Neighborhood.sinj2 y else Domain.Neighborhood.sinj1 y)
Instances For
The recursion Ο(Ξ)=z, Ο(bΒ·Ο)=f_b(Ο(Ο)) on a finite string, with base value
z.
Equations
- Domain.Neighborhood.descVal B z [] = z
- Domain.Neighborhood.descVal B z (b :: Ο) = Domain.Neighborhood.descF B b (Domain.Neighborhood.descVal B z Ο)
Instances For
The homomorphism C β E. Built by liftC from the head-recursion: Ο(Οβ₯) = f_{Ο}(β₯) and
Ο(Ο) = f_{Ο}(e), interpreting bβbββ¦ β¦ f_{bβ}(f_{bβ}(β¦)).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The homomorphism square and uniqueness #
The composite injββ(...) of T(g) applied to a successor reduces to the
operation f_b. The
single computational step behind both existence and uniqueness, for an arbitrary
g.
T(g) on the terminator is the terminator; precomposed with k it is e.
T(g) on β₯ is β₯; precomposed with k it is β₯ (both maps are strict).
Any map satisfying the homomorphism recursion equals descMap. This is
both the existence
witness (descMap satisfies it) and the uniqueness driver.
C's algebra map satisfies the recursion.
The homomorphism square, read off at the level of underlying approximable
maps:
desc β i = k β T(desc).
The descent homomorphism (C, i) β (E, k) as a T-algebra homomorphism.
Equations
- Domain.Neighborhood.descAlgHom B = { hom := Domain.Neighborhood.descStrict B, comm := β― }
Instances For
Uniqueness. Any T-algebra homomorphism out of (C, i) equals
descAlgHom.
Exercise 6.17 (existence half) β (C, i) is an initial T-algebra for
T(X) = π + X + X.
The descent map Ο : C β E is the closed-form head-recursion Ο(Ξ) = e, Ο(bΒ·x) = f_b(Ο x)
(f_b = k β inj_b), built choice-free via liftC; it is the unique T-algebra
homomorphism, so C
is determined (up to iso, Proposition 6.6) as the initial algebra of X β¦ π + X + X.
Equations
- Domain.Neighborhood.CisInitial = { desc := Domain.Neighborhood.descAlgHom, uniq := β― }