Exercise 4.19 (Scott 1981, PRG-19, Lecture IV) — verifying Example 4.4 #
Example 4.4 leaves many assertions to the reader. This module discharges the two explicitly requested ones:
"Peano's Axioms" for
{0,1}*. The structured set⟨Σ*, Λ, 0·, 1·⟩(hereΣ* = List Bool,Λ = [], and the two successorsb ↦ b :: ·) satisfies the natural two-successor analogue of Definition 4.5:Λis not a successor (peano_nil_ne_cons), each successor is injective (peano_cons_injective), the two successor ranges are disjoint (peano_cons_disjoint), and the induction principle holds (peano_induction). SoΣ*is the free monoid on two generators — the binary-tree analogue of⟨ℕ, 0, ⁺⟩.one : C → Tis definable from the rest of the structure by a fixed-point equation. We first build the three testsempty, zero, one : C → Tas honest approximable maps (Scott: "it is an exercise to show these are approximable"), via a uniform head-test combinatorliftC. We then showone(x) = cond(empty(x), false, cond(zero(x), false, true))on every generator of
|C|(one_def_strElem,one_def_strBot), exhibitingoneas the solution of a fixed-point/recursion equation in the remaining structure⟨C, Λ, 0, 1, empty, zero, cond⟩(the right-hand side does not mentionone, so this is the trivial fixed point — Scott's point that the tests are not independent).
The liftC combinator (a map C → V determined by its values on the partial
elements σ⊥ and the
total elements σ, subject to two monotonicity conditions) is reusable; with it
one likewise gets
Scott's tail : C → C (tail(bx) = x, tail(Λ) = ⊥), here noted but not needed
for one.
The liftC data is choice-free; the truth-domain tests inherit
Classical.choice
structurally from T (Example 1.2), exactly as Example23.parityMap and
Example43.zeroMap do.
Exercise 4.19 — Peano (i) for {0,1}*. Λ is not a successor: [] ≠ b :: σ.
Exercise 4.19 — Peano (ii) for {0,1}*. Each successor b ::· is
injective.
Exercise 4.19 — Peano (ii′) for {0,1}*. The two successor ranges are
disjoint:
0σ ≠ 1τ.
Exercise 4.19 — Peano (iii) for {0,1}*. Induction: a predicate holding
at Λ and closed
under both successors holds everywhere. (This is List.rec; it is the
two-successor analogue of
Definition 4.5(iii) and the recursion engine behind tail/empty/zero/one.)
Disjointness facts for C's neighbourhoods (cones vs singletons). #
A cone is never contained in a singleton (it has at least two elements).
A cone is never equal to a singleton.
The head-test value functions. #
The codomain value chosen by inspecting the head of a sequence: [] ↦ z, 0σ ↦ a₀, 1σ ↦ a₁.
With z = ⊥ this is the value at the partial element σ⊥; with z = vΛ the
value at the
total element σ.
Equations
- Domain.Neighborhood.Exercise419.headValC V z a0 a1 [] = z
- Domain.Neighborhood.Exercise419.headValC V z a0 a1 (false :: tail) = a0
- Domain.Neighborhood.Exercise419.headValC V z a0 a1 (true :: tail) = a1
Instances For
Monotonicity of the head value: along a prefix σ <+: τ, the partial value
(z = ⊥) at σ
is below any head value at τ with the same head constants. Covers both
required conditions
(cone→cone with z' = ⊥, cone→singleton with z' = vΛ).
A map C → V determined by its value coneVal σ on each partial element σ⊥
and singVal σ
on each total element σ, provided (a) the partial values are monotone along
prefixes and (b) a
partial value sits below the total value of any extending prefix. The relation
says: a cone σΣ*
relates to the neighbourhoods of coneVal σ, and a singleton {σ} to those of
singVal σ.
Equations
- One or more equations did not get rendered due to their size.
Instances For
liftC on a partial element: f(σ⊥) = coneVal σ.
liftC on a total element: f(σ) = singVal σ.
Example 4.4 — empty. empty(Λ) = true, empty(0x) = empty(1x) = false,
strict.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example 4.4 — zero. zero(Λ) = false, zero(0x) = true, zero(1x) = false, strict.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example 4.4 — one. one(Λ) = false, one(0x) = false, one(1x) = true, strict.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Value equations on total elements σ and partial elements σ⊥.
cond(⊥, x, y) = ⊥ in T, phrased with T.bot (which the head-test
empty(⊥) produces)
rather than the syntactically distinct Example23.botElt of
Exercise326.cond_bot.
The defining right-hand side: cond(empty(x), false, cond(zero(x), false, true)). It uses only
empty, zero and the conditional cond (Exercise 3.26) — not one.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exercise 4.19 (Scott 1981, PRG-19). one is definable from empty,
zero, cond: the
equation one(x) = cond(empty(x), false, cond(zero(x), false, true)) holds on
every total element
σ.
Exercise 4.19 (Scott 1981, PRG-19). The same defining equation holds on
every partial
element σ⊥ — including ⊥ = []⊥ where empty(⊥) = ⊥ forces cond(⊥, …) = ⊥.