Exercise 6.17 part 2 (Scott 1981, PRG-19) โ the generalization Cโ โ
๐ + ฮฃโ Cโ #
Example 6.2 / Exercise 6.17 ask for the generalization of C corresponding to
Scott's A โ
Aโฟ + Aโฟ:
replace the two-letter alphabet {0,1} of C (C โ
๐ + C + C) by an arbitrary
alphabet A. The
domain Cโ of finite or infinite A-sequences then satisfies the domain
equation
Cโ โ
๐ + ฮฃ_{a:A} Cโ (the A-indexed separated sum of copies of Cโ).
Instantiating A := Fin n
gives Cโ โ
๐ + nยทCโ; A := Bool recovers Example 6.2's C.
This module mirrors, generically over an alphabet A with decidable equality, the
binary development
of Example44 (the domain), Example62/Example62C (the sum and the
isomorphism) and Exercise617
(initiality).
Stage 1 (this section): the generic domain Cโ #
Strn A = List A; cones coneN ฯ = ฯA*; the neighbourhood system Cn = {ฯA*} โช {{ฯ}}; the total
elements strElemN ฯ and partial elements strBotN ฯ; and the successors
consMapN a : Cโ โ Cโ
prepending the letter a. Everything is the alphabet-generic copy of Example44,
and the data
(Cn, consMapN) stays choice-free.
The token type A* of finite A-strings.
Equations
Instances For
The cone ฯA*: all extensions of ฯ.
Equations
Instances For
The generic domain Cโ of finite-or-infinite A-sequences.
Equations
Instances For
The partial element ฯโฅ = โฯA*.
Equations
Instances For
The total element ฯ = โ{ฯ}.
Equations
Instances For
Stage 2: the A-indexed separated sum Tsig(X) = ๐ + ฮฃ_{a:A} X #
The right-hand side of the generalized domain equation. Tokens are Option (Unit โ (A ร ฮฒ)): a
fresh basepoint ฮ = none, the lone ๐-token tu = some (inl ()), and the
A-indexed family of
tagged copies tc a t = some (inr (a, t)). This is the alphabet-generic analogue
of Example62C's
three-way sum3 unitSys C C (= ๐ + C + C), the index Bool being replaced by
A.
The a-indexed tagged copy aX.
Equations
- Domain.Neighborhood.Exercise617Gen.jc a X = {w : Domain.Neighborhood.Exercise617Gen.SigTok A ฮฒ | โ (t : ฮฒ), w = Domain.Neighborhood.Exercise617Gen.tc a t โง t โ X}
Instances For
The master neighbourhood {ฮ} โช {tu} โช โ_a aฮ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The A-indexed separated sum ๐ + ฮฃ_a V over {ฮ} โช {tu} โช โ_a aฮ,
under the standing
assumption that no neighbourhood of V is empty. The alphabet-generic analogue of
sum3 unitSys V V
(Example 6.2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Shape lemmas: no nesting through the wrong tag. #
A sumSig-neighbourhood contained in an a-copy aX is itself an a-copy.
The basepoint/๐-injection: the image of the unique point of ๐. Its proper
neighbourhood is
the ๐-copy jU.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The a-th copy injection V โช ๐+ฮฃ_a V: send xโ|V| to the sum element whose
proper
neighbourhoods are the a-copies aX with Xโx.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The sum map ฮฃ f = I_๐ + ฮฃ_a f and its functoriality. #
The indexed sum map ฮฃf = I_๐ + ฮฃ_a f acting as the identity on the
๐-summand and as f
on each a-copy. The generic analogue of sumMap3 (idMap unitSys) f f.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The sum map is strict: it sends โฅ = master only to master.
ฮฃf fixes the basepoint injection.
ฮฃf on the a-copy injection: (ฮฃf)(inj_a x) = inj_a (f x).
Functoriality (identities): ฮฃ(I) = I.
Functoriality (composition): ฮฃ(gโf) = ฮฃg โ ฮฃf.
Tsig on objects: Tsig(D) = ๐ + ฮฃ_a D, again โ
-free (sumSig_nonempty).
Equations
- Domain.Neighborhood.Exercise617Gen.tsigObj A D = { carrier := Domain.Neighborhood.Exercise617Gen.SigTok A D.carrier, sys := Domain.Neighborhood.Exercise617Gen.sumSig A D.sys โฏ, nonempty := โฏ }
Instances For
Tsig on maps: Tsig(f) = I_๐ + ฮฃ_a f, strict by isStrict_sumMapSig.
Equations
Instances For
The functor Tsig(X) = ๐ + ฮฃ_{a:A} X on the category of โ
-free domains
and strict
maps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stage 3: the domain equation Cโ โ
๐ + ฮฃ_a Cโ. #
The alphabet-generic analogue of Example62C (C โ
๐ + C + C). Prepending the
letter a to a
neighbourhood gives embA a X; a Cโ-neighbourhood is the master, the terminator
{ฮ}, or some
a-copy aX, exactly the shapes of the A-indexed sum ๐ + ฮฃ_a Cโ.
aX = {a :: w' โฃ w' โ X}: the a-prefixed copy of a neighbourhood.
Equations
Instances For
The sum target ๐ + ฮฃ_a Cโ and its inversion lemmas. #
The right-hand side of the domain equation: the A-indexed sum ๐ + ฮฃ_a Cโ.
Equations
Instances For
Forward half of Cโ โ
๐ + ฮฃ_a Cโ. Records, for each branch, whether x
finishes at ฮ
(the ๐-summand) or reaches the a-copy aX (the a-th summand).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Inverse half of Cโ โ
๐ + ฮฃ_a Cโ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The two halves are mutually inverse. #
The isomorphism |Cโ| โo |๐ + ฮฃ_a Cโ|.
Equations
- One or more equations did not get rendered due to their size.
Instances For
toCC โ (aยท) = inj_a. Prepending the letter a to z is, across Cโ โ
๐+ฮฃ_a Cโ, the
injection of z into the a-th summand.
Cโ as an object of the โ
-free category.
Equations
- Domain.Neighborhood.Exercise617Gen.Cnobj A = { carrier := Domain.Neighborhood.Exercise617Gen.Strn A, sys := Domain.Neighborhood.Exercise617Gen.Cn A, nonempty := โฏ }
Instances For
The Tsig-algebra structure on Cโ. The structure map i : ๐+ฮฃ_a Cโ โ Cโ is the
inverse of
the domain-equation isomorphism ccEquiv, strict by isStrict_ofIso.
Equations
Instances For
Cโ is a Tsig-algebra for Tsig(X) = ๐ + ฮฃ_a X.
Equations
Instances For
A map Cโ โ V determined by its value coneVal ฯ on each partial element
ฯโฅ and singVal ฯ
on each total element ฯ. (The alphabet-generic copy of Exercise419.liftC.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Two maps out of Cโ agree once they agree on every ฯโฅ and ฯ (generic
Exercise516.map_ext_C).
The distinguished point e = k(inj_๐): the image under k of the terminator.
Equations
Instances For
The a-th successor operation f_a = k โ inj_a.
Equations
Instances For
The recursion ฯ(ฮ)=z, ฯ(aยทฯ)=f_a(ฯ(ฯ)) on a finite string, with base value
z.
Equations
Instances For
The homomorphism Cโ โ E, built by liftCn from the head-recursion.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The bundled strict homomorphism Cโ โ E.
Equations
Instances For
The homomorphism square and uniqueness. #
Any map satisfying the homomorphism recursion equals descMap.
The descent homomorphism (Cโ, i) โ (E, k) as a Tsig-algebra
homomorphism.
Equations
- Domain.Neighborhood.Exercise617Gen.descAlgHom B = { hom := Domain.Neighborhood.Exercise617Gen.descStrict B, comm := โฏ }
Instances For
Uniqueness. Any Tsig-algebra homomorphism out of (Cโ, i) equals
descAlgHom.
Exercise 6.17 part 2 โ (Cโ, i) is an initial Tsig-algebra for Tsig(X) = ๐ + ฮฃ_a X.
The descent map ฯ : Cโ โ E is the closed-form head-recursion ฯ(ฮ) = e, ฯ(aยทx) = f_a(ฯ x)
(f_a = k โ inj_a), built choice-free via liftCn; it is the unique
Tsig-algebra homomorphism, so
Cโ is the initial algebra of X โฆ ๐ + ฮฃ_a X.
Equations
- Domain.Neighborhood.Exercise617Gen.CnisInitial A = { desc := Domain.Neighborhood.Exercise617Gen.descAlgHom, uniq := โฏ }
Instances For
Exercise 6.17 part 2 โ the domain equation Cโ โ
๐ + ฮฃ_a Cโ.
Instantiation: Cโ โ
๐ + nยทCโ over the n-letter alphabet Fin (n+1). #
Taking A := Fin (n+1) recovers Scott's Cโ: the domain of finite-or-infinite
sequences over an
(n+1)-letter alphabet, satisfying Cโ โ
๐ + (n+1)ยทCโ. (For n = 1, Fin 2 โ Bool recovers
Example 6.2's C โ
๐ + C + C.)