Exercise 6.19 (Scott 1981, PRG-19, ยง6) โ Part B: the functor algebra #
โฆ Now generate all constructs
T(X)formed by the constants (that is,T(X) = ๐for a fixed๐), by the identity (T(X) = X), and by sums and products (Tโ(X) + Tโ(X), etc.). Show that these are all functors, continuous on maps, and monotone and continuous on domains.
This module formalizes Part B: the closed family of constructs T(X) over
Scott's uniform
category of Exercise 6.19 โ neighbourhood systems on ฮ โ {0,1}* with โ
โ ๐
(the standing
hypothesis that makes the token-level sum sumTok/product prodTok of Part A
genuine
endo-operations) and strict approximable maps.
Contents #
ScottSysโ an object of Scott's category: anโ-free neighbourhood system overStr = {0,1}*.- The object actions
ScottSys.sum/ScottSys.prod(Part A'ssumTok/prodTok, repackaged so they stay inside the category) and the constant/identity objects. - The functorial action on maps:
sumMapTok fโ fโ : (๐โ+๐โ) โ (โฐโ+โฐโ)andprodMapTok fโ fโ : (๐โร๐โ) โ (โฐโรโฐโ), each an approximable map, with strictness preservation (sumMapTokis always strict;prodMapTokis strict when both factors are). - The bifunctor laws: both actions preserve identities and composition
(
sumMapTok_id/sumMapTok_comp,prodMapTok_id/prodMapTok_comp). - The functor-expression algebra
FExpr(constants, identity, sum, product), its object actionFExpr.obj, its action on mapsFExpr.map.
Scott asks to show these constructs are all functors, continuous on maps, and monotone and continuous on domains; each is established here:
- functors โ
FExpr.map_id(T(I)=I) andFExpr.map_comp(T(gโf)=T(g)โT(f)), by induction; plusFExpr.map_isStrict(soTrestricts to Scott's strict-map category). - continuous on maps โ
FExpr.map_mono(a sharper map gives a sharper image) andFExpr.map_continuous(ฮปf. T(f)preserves directed unions of maps); together these are exactly approximability ofฮปf. T(f)(Exercise 2.13). - monotone on domains โ
FExpr.obj_subsystem(D โ E โน T(D) โ T(E)). - continuous on domains โ
FExpr.obj_continuous(ฮปD. T(D)preserves directed unions of subsystems, the form Scott uses in Theorem 6.14).
Because every construct stays over the single token type {0,1}*, the subdomain
relation โ is
between systems on a common carrier, so the domain conditions need no carrier
transport (unlike the
universe-polymorphic Endofunctor DomainObj form of Definitions 6.8/6.13).
This module also formalizes Exercise 6.20: writing tok(๐) = ๐.master for the
underlying token
set and {ฮ} for the one-neighbourhood system singletonSys ฮ, the function ฮปฮ. tok(T({ฮ})) is
computed by the token-level recursion mFun T (mFun_eq_master), shown monotone
(mFun_mono) and
continuous (mFun_continuous) on the domain {ฮ โฃ ฮ โ ฮ}. Its least fixed point
โ the explicit
Kleene union โโ mFunโฟ({ฮ}) โ gives a ฮ = tok(T({ฮ}))
(exists_tok_fixedPoint), whence
{ฮ} โ T({ฮ}) (exists_singleton_subsystem), exactly the hypothesis Theorem 6.14
needs.
Everything is choice-free (#print axioms โ {propext, Quot.sound}).
Objects of Scott's category: โ
-free systems over {0,1}* #
An object of the Exercise 6.19 category. An โ
-free neighbourhood system
over
Str = {0,1}* (ne: every neighbourhood is non-empty, Scott's โ
โ ๐).
The underlying neighbourhood system on
{0,1}*.- ne (X : Set ExampleB.Str) : self.sys.mem X โ X.Nonempty
โ โ ๐: every neighbourhood is non-empty.
Instances For
A non-empty b-tagged copy can never sit inside a b'-tagged copy for b โ b'.
The functorial action of sum on maps #
fโ + fโ, the action of the sum functor on (approximable) maps. It
carries the master
to the
master (so it is strict), a left copy 0X to 0X' whenever X fโ X', and a
right copy 1Y to
1Y' whenever Y fโ Y'.
Equations
- One or more equations did not get rendered due to their size.
Instances For
sumMapTok is strict for any component maps: the master input ฮ (the
only neighbourhood
containing the empty string) relates only to the output master.
The functorial action of product on maps #
fโ ร fโ, the action of the product functor on (approximable) maps. A
product
neighbourhood {ฮ} โช 0X โช 1Y is sent to {ฮ} โช 0X' โช 1Y' whenever X fโ X' and
Y fโ Y'.
Equations
- One or more equations did not get rendered due to their size.
Instances For
prodMapTok is strict exactly when both components are strict.
The bifunctor laws: identities and composition are preserved #
(I_{๐โ} + I_{๐โ}) = I_{๐โ+๐โ}.
(gโ โ fโ) + (gโ โ fโ) = (gโ + gโ) โ (fโ + fโ).
(I_{๐โ} ร I_{๐โ}) = I_{๐โร๐โ}.
(gโ โ fโ) ร (gโ โ fโ) = (gโ ร gโ) โ (fโ ร fโ).
The functor-expression algebra T(X) and the functor laws #
"Generate all constructs T(X) formed by the constants (T(X) = ๐), by the
identity (T(X) = X),
and by sums and products."
The functor-expression algebra. A T(X) built from constants, the
identity, and binary sums
and products โ Scott's closed family of constructs.
- const : ScottSys โ FExpr
The constant functor
T(X) = ๐at a fixed object๐. - var : FExpr
The identity functor
T(X) = X. - sum : FExpr โ FExpr โ FExpr
The sum
Tโ(X) + Tโ(X). - prod : FExpr โ FExpr โ FExpr
The product
Tโ(X) ร Tโ(X).
Instances For
The action of T on (approximable) maps. Constants act by the identity,
the identity
functor
acts by f itself, and sums/products act by the bifunctorial combinators
sumMapTok/prodMapTok.
Equations
- (Domain.Neighborhood.Exercise619.FExpr.const D).map xโ = Domain.Neighborhood.ApproximableMap.idMap D.sys
- Domain.Neighborhood.Exercise619.FExpr.var.map xโ = xโ
- (Tโ.sum Tโ).map xโ = Domain.Neighborhood.Exercise619.sumMapTok (Tโ.map xโ) (Tโ.map xโ)
- (Tโ.prod Tโ).map xโ = Domain.Neighborhood.Exercise619.prodMapTok (Tโ.map xโ) (Tโ.map xโ)
Instances For
Every T preserves strictness (so it restricts to Scott's category of
strict maps): T(f)
is strict whenever f is (and constants/sums are strict unconditionally).
Functor law 1 โ T(I_X) = I_{T(X)}. Every construct T preserves
identities.
Functor law 2 โ T(g โ f) = T(g) โ T(f). Every construct T preserves
composition;
together
with map_id this shows these are all functors.
Continuous on maps โ the monotone half #
Scott's continuous on maps (Definition 6.8) requires ฮปf. T(f) to be
approximable on the strict
function space; here we record its monotonicity (the order half of
approximability โ a sharper map
yields a sharper image), proved compositionally from the bifunctor combinators.
sumMapTok is monotone in both arguments.
prodMapTok is monotone in both arguments.
Monotone on domains #
Scott's monotone on domains (Definition 6.13): a subdomain relation D โ E is
carried to
T(D) โ T(E). Because every construct here stays over the single token type
{0,1}*, the relation is
between systems on a common carrier (no transport needed), and the bifunctor
combinators carry โ
componentwise.
Continuous on domains #
Scott's continuous on domains (Definition 6.13): ฮปD. T(D) preserves directed
unions of
subsystems. Concretely, if U is the union of a non-empty โ-directed family โฑ
of subsystems of
U, then every neighbourhood of T(U) already appears in some T(D) with D โ โฑ (and conversely).
The forward direction is by induction; the products use directedness to merge the
two component
witnesses into a single D.
ฮปD. T(D) is continuous on domains. For a non-empty โ-directed family
โฑ of
subsystems of
U whose union is U, the neighbourhood family of T(U) is the union of those
of the T(D).
Continuous on maps โ full directed-sup preservation #
Scott's continuous on maps (Definition 6.8): ฮปf. T(f) is approximable,
equivalently (Exercise
2.13) it is continuous โ monotone (map_mono) and preserving directed unions of
maps. If f is the
pointwise union of a non-empty directed family gแตข, then T(f) is the pointwise
union of the
T(gแตข). The products use directedness to merge the two component witnesses.
Forward direction of continuity on maps: a related pair of T(f) is already
related by some
T(gแตข).
ฮปf. T(f) is continuous on maps. For a non-empty directed family gแตข
with pointwise union
f, the relation of T(f) is the union of those of the T(gแตข) โ T(f) is
approximable.
Exercise 6.20 โ ฮปฮ. tok(T({ฮ})) is continuous, hence a fixed point exists #
For any system
๐lettok(๐)be the underlying set of tokens, so that๐is a system overtok(๐). For the category of Exercise 6.19 show that the functionฮปฮ. tok(T({ฮ}))is continuous on the domain{ฮ โ {0,1}* โฃ ฮ โ ฮ}, whereTis any of the functors generated in 6.19. Conclude that there must exist a setฮ = tok(T({ฮ})), so that{ฮ} โ T({ฮ}), and so 6.14 applies.
Here tok(๐) = ๐.master (the master neighbourhood is the token set ฮ, since
๐ โ ๐ซ(ฮ)), and
{ฮ} is the one-neighbourhood system singletonSys ฮ with master ฮ. The key
simplification is
that the master of T({ฮ}) is computed by a tiny token-level recursion mFun T
that needs no
NeighborhoodSystem data at all: constants are constant, the identity returns
ฮ, and both sum
and product return {ฮ} โช 0ยท(โฆ) โช 1ยท(โฆ) (sumTokMaster = prodTokNbhd on
masters). mFun_eq_master
identifies mFun T ฮ with tok(T({ฮ})). The function mFun T is monotone
(mFun_mono) and
continuous โ in fact fully additive โ on the powerset of {0,1}*
(mFun_continuous), so its
restriction to {ฮ โฃ ฮ โ ฮ} is continuous on that domain. The least fixed point
above the bottom
{ฮ} is the explicit Kleene union โโ mFunโฟ({ฮ}) (mIter), giving ฮ = tok(T({ฮ}))
(exists_tok_fixedPoint) and hence {ฮ} โ T({ฮ}) (exists_singleton_subsystem),
exactly the
hypothesis Theorem 6.14 needs. (For the bottom to stay in the domain we need ฮ โ tok(C) for the
constant systems C; this is recorded by FExpr.RootedConst, and holds
automatically for sums and
products since their masters contain ฮ.)
tok(๐) โ the underlying set of tokens of a system, i.e. its master
neighbourhood ฮ.
Instances For
The one-neighbourhood system {ฮ} over {0,1}*: its only neighbourhood
is ฮ itself, and
its master (token set) is ฮ. It is โ
-free precisely because ฮ is non-empty.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The token-level master recursion. mFun T ฮ computes tok(T({ฮ})) purely
from ฮ, without
touching the neighbourhood data of {ฮ} (mFun_eq_master): constants are
constant, the identity
returns ฮ, and both sum and product wrap the two component token sets with the
tags 0,1 under a
common root ฮ (sumTokMaster = prodTokNbhd agree on masters).
Equations
- One or more equations did not get rendered due to their size.
- Domain.Neighborhood.Exercise619.mFun (Domain.Neighborhood.Exercise619.FExpr.const C) xโ = C.sys.master
- Domain.Neighborhood.Exercise619.mFun Domain.Neighborhood.Exercise619.FExpr.var xโ = xโ
Instances For
mFun T ฮ is exactly the token set tok(T({ฮ})) = (T.obj {ฮ}).sys.master.
Monotone on the domain #
Monotonicity of the tagged-union shape shared by sum and product.
ฮปฮ. tok(T({ฮ})) is monotone on the domain.
Continuous on the domain #
Continuity (full additivity) of the tagged-union shape shared by sum and product.
ฮปฮ. tok(T({ฮ})) is continuous on the domain {ฮ โฃ ฮ โ ฮ}. For a
non-empty โ-directed
family โฑ with union U, the token set of T({U}) is the union of those of the
T({ฮ}). (The
proof in fact establishes full additivity โ directedness is not needed for the
master level โ but the
statement is the directed-sup form Scott calls continuous.)
A fixed point ฮ = tok(T({ฮ})) โ so {ฮ} โ T({ฮ}) and 6.14 applies #
ฮ โ tok(C) for every constant C occurring in T. This is what keeps
the bottom
{ฮ} and
the whole Kleene chain inside the domain {ฮ โฃ ฮ โ ฮ}; sums and products satisfy
it for free.
Equations
Instances For
If ฮ โ ฮ then ฮ โ tok(T({ฮ})) โ so ฮปฮ. tok(T({ฮ})) is an endofunction of
the domain.
The Kleene iteration mFunโฟ({ฮ}) whose union is the least fixed point
above {ฮ}.
Equations
Instances For
The Kleene union is a fixed point of ฮปฮ. tok(T({ฮ})).
The conclusion of Exercise 6.20 (token level). For any construct T whose
constants contain
ฮ, there is a set ฮ with ฮ โ ฮ and ฮ = tok(T({ฮ})).
The conclusion of Exercise 6.20 (object level): {ฮ} โ T({ฮ}), so Theorem
6.14 applies.
From the fixed point ฮ = tok(T({ฮ})), the one-neighbourhood system {ฮ} is a
subsystem of
T({ฮ}): they share the master ฮ, and ฮ is a (the master) neighbourhood of
T({ฮ}).