Exercise 6.23 (Scott 1981, PRG-19, §6) — the syntactic domain of expressions #
EXERCISE 6.23. Construe the initial solution to
Exp ≅ N ⊕ ((Exp × Exp) + (Exp × Exp))as a "syntactical domain" of expressions generated from infinitely many "variables" by means of two binary "operation symbols". Given an algebraDwith two operationsu : D×D → Dandv : D×D → D, show how any strict maps : N → Ddetermines a unique mapval(s) : Exp → Dthat can be regarded as the "evaluation of an expression".
The right-hand functor is T(X) = N ⊕ ((X×X) + (X×X)), i.e. in the algebra
GExpr of Exercise 6.21,
Texp N = .oplus (.const N) (.sum (.prod .var .var) (.prod .var .var)). Reading
the structure map
k : T(Exp) → Exp of an algebra through the universal properties of ⊕, +,
×:
- the
⊕ Nsummand gives a strict variable maps : N → Exp(the "infinitely many variables" are the tokens / points ofN); - the two
(Exp × Exp)summands, combined by+, give two binary operation symbolsu, v : Exp × Exp → Exp.
So an algebra of this functor is exactly a domain D with a strict s : N → D
and two binary
operations u, v : D×D → D, and the unique homomorphism val(s) : Exp → D is
Scott's "evaluation
of an expression": it sends a variable to its value under s, and an u/v-node
to the u/v of
the values of its two subexpressions.
This module (Phase 1 — the domain Exp itself) #
Following Scott's standing restriction in Exercises 6.19–6.23 to ∅-free systems
over {0,1}* and
strict maps (ScottSys), and following the structure of Theorem 6.14 (the
initial solution is
the iterated colimit 𝒟 = ⋃ₙ Tⁿ({Γ})), we build the concrete solution domain
for any rooted
GExpr functor T:
gFix T = ⋃ₙ gFunⁿ({Λ})— the token set (Exercise 6.20/6.21 fixed pointΓ = tok(T({Γ})));gTower T n = Tⁿ({Γ})— the iterated-functor tower of∅-free systems overStr;gColim T = ⋃ₙ Tⁿ({Γ})— the colimit system, withgColim_obj_eq : T(gColim) = gColim(the structure map is the identity, since the two systems are literally equal — no carrier transport is needed becauseScottSyskeeps the token type fixed atStr).
Instantiating at Texp N gives Exp N := gColim (Texp N) together with the
domain-equation
isomorphism Exp ≅ N ⊕ ((Exp×Exp)+(Exp×Exp)) (Exp_structure_eq). The
algebra decomposition
(s, u, v) and the unique evaluation homomorphism val(s) (initiality) are
developed in later
phases.
Everything is choice-free (#print axioms ⊆ {propext, Quot.sound}); the
colimit is genuine data
built without Classical.choice (the generator Γ is the explicit Kleene
union, not an
existential witness).
The generator Γ = ⋃ₙ gFunⁿ({Λ}) (the Exercise 6.20/6.21 fixed point, as #
data)
The fixed-point token set Γ = tok(T({Γ})), as the explicit Kleene union
⋃ₙ gIter T n
(no Classical.choice).
Equations
Instances For
Γ = tok(T({Γ})) at the token level: gFun T Γ = Γ.
The iterated-functor tower Tⁿ({Γ}) #
The one-point generator {Γ} as an object of the category.
Equations
Instances For
The tower Tⁿ({Γ}) of ∅-free systems over Str: T⁰({Γ}) = {Γ},
Tⁿ⁺¹({Γ}) = T(Tⁿ({Γ})).
Equations
Instances For
The colimit 𝒟 = ⋃ₙ Tⁿ({Γ}) #
The colimit system 𝒟 = ⋃ₙ Tⁿ({Γ}) as an ∅-free system over Str. A
set is a
neighbourhood exactly when it is a neighbourhood of some level; closure under
consistent intersection
uses that the tower is a chain (any finite collection sits inside one level).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Each level of the tower is a subdomain of the colimit: Tⁿ({Γ}) ◁ 𝒟.
The structure isomorphism T(𝒟) = 𝒟 #
T(𝒟) = 𝒟 at the level of neighbourhood systems. Membership: continuity
on domains
(obj_continuous) along the directed tower turns T(⋃ₙ Tⁿ({Γ})) into ⋃ₙ Tⁿ⁺¹({Γ}), which has the
same neighbourhoods as ⋃ₙ Tⁿ({Γ}) (the extra n=0 level T⁰({Γ}) is absorbed
by the chain step).
Master: both are Γ (gTower_master through obj_subsystem of Tⁿ({Γ}) ◁ 𝒟).
The structure isomorphism T(𝒟) ≅ 𝒟 is the identity (the two objects are
literally
equal).
The functor T(X) = N ⊕ ((X×X) + (X×X)) of Exercise 6.23, as a GExpr
over the variable
domain N. The ⊕ N carries the variables, and the two (X×X) summands
(combined by +) carry the
two binary operation symbols.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Phase 2 — the strict-map category, the endofunctor T, and the algebra #
Following Scott (and Exercise 6.17's StrictDomainObj), but over the fixed
token type Str: the
objects are ScottSys (∅-free systems over Str), the morphisms are strict
approximable maps.
Because every object lives over Str, all carrier equalities are rfl and there
is no HEq
transport (the obstruction that made the abstract Theorem 6.14 unusable). The
functor Texp N then
becomes a genuine Endofunctor of this category, and the colimit Exp of Phase 1
— together with the
structure equality T(Exp) = Exp — is a T-algebra.
The category of ∅-free domains over Str and strict maps. Morphisms are
strict
approximable
maps (StrictMap); identities and associative composition are Theorem 2.5, with
strictness preserved
by isStrict_idMap/isStrict_comp. The fixed carrier Str is what removes all
the carrier-transport
HEq that burdens the abstract Endofunctor DomainObj.
Equations
- One or more equations did not get rendered due to their size.
The morphism action of gFunctor T: a strict f is sent to the strict map
T(f). (Typed via
StrictMap, which is defeq to the category's Hom; this avoids the
class-projection that blocks the
anonymous .1 on Category.Hom.)
Equations
- Domain.Neighborhood.Exercise619.gFunctorMap T f = ⟨T.map ↑f, ⋯⟩
Instances For
Every GExpr is an Endofunctor of the strict-map category. On objects
it is GExpr.obj;
on a strict map f it is the strict map T(f) (GExpr.map_isStrict).
Functoriality is
GExpr.map_id and GExpr.map_comp (the latter needs g strict — automatic here,
since every
morphism of this category is strict).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The endofunctor T(X) = N ⊕ ((X×X) + (X×X)) of Exercise 6.23.
Equations
Instances For
The structure isomorphism T(Exp) ≅ Exp. Since Phase 1 proved T(Exp) = Exp as objects
(Exp_structure_eq), this is the identity isomorphism.
Instances For
Exp as a T-algebra with structure map the isomorphism T(Exp) ≅ Exp
(the identity,
since
T(Exp) = Exp). This realises Scott's "construe the initial solution as a
syntactic domain of
expressions": Exp is an algebra of T(X) = N ⊕ ((X×X)+(X×X)).
Equations
- Domain.Neighborhood.Exercise619.ExpAlg N hN = { carrier := Domain.Neighborhood.Exercise619.Exp N hN, str := (Domain.Neighborhood.Exercise619.ExpIso N hN).hom }
Instances For
Phase 3 — the evaluation homomorphism val(s) (existence) #
Given any algebra B = (D, k) of T(X) = N ⊕ ((X×X)+(X×X)) — i.e. a domain D
carrying (through the
universal properties of ⊕,+,×) a strict variable map s : N → D and two
binary operations
u, v : D×D → D — we build a T-algebra homomorphism val : Exp → D. This is
Scott's "evaluation
of an expression".
Since Phase 1's structure map i : T(Exp) → Exp is the identity
(Exp_structure_eq), the
homomorphism equation val ∘ i = k ∘ T(val) is the fixed-point equation val = k ∘ T(val) ∘ j
(j = i⁻¹). We solve it directly by the Kleene iteration valₙ (val₀ = ⊥,
valₙ₊₁ = k ∘ T(valₙ) ∘ j) and take val = ⋃ₙ valₙ. The fixed-point property
uses continuity on
maps (GExpr.map_continuous: T(⋃ valₙ) = ⋃ T(valₙ)); no projection machinery
is needed for
existence. (Uniqueness — initiality — is the remaining Phase 4.)
The structure map of an algebra B, as a raw approximable map (its strictness
is
algStr_strict).
The ascription to StrictMap forces the categorical Hom to its underlying
subtype.
Equations
Instances For
The Kleene iterates valₙ : Exp → D of the operator λh. k ∘ T(h) ∘ j.
val₀ = ⊥,
valₙ₊₁ = k ∘ T(valₙ) ∘ j.
Equations
- One or more equations did not get rendered due to their size.
- Domain.Neighborhood.Exercise619.descRel hN B 0 = Domain.Neighborhood.constMap (Domain.Neighborhood.Exercise619.Exp N hN).sys B.carrier.sys.bot
Instances For
The constant ⊥ map is below every approximable map (it relates each domain
neighbourhood only
to the codomain master, which every map produces by monotonicity from
master_rel).
The fixed-point equation val = k ∘ T(val) ∘ j. Forward: an iterate
valₙ is, after the
recursion, k ∘ T(valₙ₋₁) ∘ j, and T(valₙ₋₁) ⊆ T(val) by continuity on maps.
Backward: a witness
factoring through T(valₙ) lands in valₙ₊₁.
The evaluation homomorphism val(s) : Exp → D as a T-algebra
homomorphism — Scott's
existence of the evaluation map.
Equations
- Domain.Neighborhood.Exercise619.descAlgHom hN B = { hom := ⟨Domain.Neighborhood.Exercise619.descMap hN B, ⋯⟩, comm := ⋯ }
Instances For
Every homomorphism g : Exp → D is a fixed point of the operator λh. k ∘ T(h) ∘ j.
This is
the homomorphism square g ∘ i = k ∘ T(g) (g.comm) rearranged by i ∘ j = I.
descAlgHom is the least homomorphism: val ≤ g for every homomorphism
g : Exp → D. The
Kleene iterates valₙ lie below any fixed point g (induction: val₀ = ⊥ ≤ g,
and the operator is
monotone with g its own fixed point), so their union val does too. This is the
easy half of
initiality; the matching g ≤ val (so g = val) is the projection-chain argument
of Phase 4.
Phase 4 — uniqueness of val(s) and initiality of Exp #
Scott proves homomorphisms out of the iterated colimit are unique by showing they
are determined on
the finite elements: the projection chain ρₙ = iₙ ∘ jₙ (Proposition 6.12's pair
for
Texpⁿ({Γ}) ◁ Exp) satisfies T(ρₙ) = ρₙ₊₁ and ⋃ₙ ρₙ = I_Exp, so any
homomorphism g equals
⋃ₙ g ∘ ρₙ, a sequence that is forced by the recursion (independent of g). The
crux is the
concrete "monotone on domains" content (Definition 6.13): the functor Texp
carries the canonical
6.12 projection pair of D ◁ E to that of T(D) ◁ T(E) — here a genuine
equality of maps over
Str (no HEq carrier transport, the whole point of staying in ScottSys).
This section establishes that crux as GExpr.map_inj/GExpr.map_proj (by
induction over the six
functor constructors), then mirrors Theorem 6.14's uniqueness argument concretely.
Proposition 6.12 helpers: the projection pair is strict, and trivial on `D #
◁ D`
The injection i : D → E of a subsystem is strict: i sends Δ_D only
to Δ_E.
The functor carries projection pairs: the token-level lemmas #
The crux (Definition 6.13, concrete): T carries the 6.12 projection pair #
This is the monotone on domains content of Definition 6.13, but here a genuine
equality of maps
over the single token type Str (no HEq carrier transport): the functor T = GExpr sends the
injection/projection of D ◁ E to the injection/projection of T(D) ◁ T(E).
Proved by induction
over the six constructors using the token-level lemmas just established.
The identity structure isomorphism, relationally #
The forward map of the identity iso isoOfObjEq e is the inclusion X ↪ Y (=
idMap
across the
object equality e).
The inverse map of the identity iso isoOfObjEq e.
The projection chain ρₙ = iₙ ∘ jₙ and ⋃ₙ ρₙ = I_Exp #
The crux equation ρₙ₊₁ = i ∘ T(ρₙ) ∘ j #
g-independence of g ∘ ρₙ and uniqueness #
g ∘ ρₙ = val₀ₙ: every homomorphism g agrees with the canonical Kleene
iterate after the
n-th projection — the sequence is forced by the recursion, independent of g.
Exercise 6.23 (Scott 1981, PRG-19) — Exp is the initial T-algebra. For
every algebra
B = (D, s, u, v) there is a unique homomorphism val(s) : Exp → D — Scott's
evaluation of an
expression. Existence is descAlgHom (Phase 3); uniqueness is the
projection-chain argument.
Equations
- One or more equations did not get rendered due to their size.