Documentation

LeanPool.DomainTheory.Neighborhood.Exercise618

Exercise 6.18 (Scott 1981, PRG-19, Β§6) β€” π’Ÿ^∞ as an initial algebra #

EXERCISE 6.18. With reference back to Exercise 3.16 discuss the construction of π’Ÿ^∞ as an initial algebra and as a solution to the domain equation π’Ÿ^∞ β‰… π’Ÿ Γ— π’Ÿ^∞.

Exercise 3.16 already constructs the infinite iterate π’Ÿ^∞ (iterSys, over β„• Γ— Ξ”) and proves the domain-equation half, π’Ÿ^∞ β‰… π’Ÿ Γ— π’Ÿ^∞ (iter_isomorphic, with the explicit element iso iterProdIso). This module supplies the initial-algebra half.

For a fixed βˆ…-free domain π’Ÿ consider the (product) endofunctor T(X) = π’Ÿ Γ— X. The domain equation π’Ÿ^∞ β‰… T(π’Ÿ^∞) makes π’Ÿ^∞ a T-algebra, with structure map i : π’Ÿ Γ— π’Ÿ^∞ β†’ π’Ÿ^∞ the "cons" isomorphism (Exercise 3.16's iterProdIso⁻¹). We prove π’Ÿ^∞ is the initial T-algebra: for every T-algebra (E, k) there is a unique (strict) homomorphism π’Ÿ^∞ β†’ E, namely h(⟨xβ‚€,x₁,β€¦βŸ©) = k(xβ‚€, k(x₁, k(xβ‚‚, …))), the least fixed point of Ξ»h. k ∘ T(h) ∘ j.

Architecture #

The genuine analysis is done at the level of plain approximable maps (over iterSys V, prod V (iterSys V), and a target E), then packaged into the bespoke category StrictDomainObj of βˆ…-free domains and strict maps (Exercise 6.17), where IsInitial directly expresses Scott's universal property among strict algebras (cf. Theorem 6.14, which is initiality among strict algebras β€” the product functor grows the token set, so Theorem 6.14's same-carrier colimit tower does not apply, and π’Ÿ^∞ must be built directly as in Exercise 3.16).

Everything is choice-free where it is data.

βˆ…-freeness is preserved by prod and iterSys #

theorem Domain.Neighborhood.Exercise618.prod_nonempty {Ξ± : Type u_1} {Ξ² : Type u_2} {Vβ‚€ : NeighborhoodSystem Ξ±} {V₁ : NeighborhoodSystem Ξ²} (hβ‚€ : βˆ€ (X : Set Ξ±), Vβ‚€.mem X β†’ X.Nonempty) (_h₁ : βˆ€ (Y : Set Ξ²), V₁.mem Y β†’ Y.Nonempty) (W : Set (Ξ± βŠ• Ξ²)) :
(prod Vβ‚€ V₁).mem W β†’ W.Nonempty

The product of two βˆ…-free systems is βˆ…-free.

theorem Domain.Neighborhood.Exercise618.iterSys_nonempty {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} (h : βˆ€ (X : Set Ξ±), V.mem X β†’ X.Nonempty) (W : Set (β„• Γ— Ξ±)) :
(iterSys V).mem W β†’ W.Nonempty

The infinite iterate of an βˆ…-free system is βˆ…-free (each fibre is a non-empty neighbourhood).

The "cons" description of the Exercise 3.16 isomorphism #

theorem Domain.Neighborhood.Exercise618.iterProdIso_apply {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} (z : (iterSys V).Element) :
(iterProdIso V) z = pair (component z 0) (ofSeq fun (n : β„•) => component z (n + 1))

The forward iso reads off head and tail. iterProdIso z = ⟨zβ‚€, ⟨z₁,zβ‚‚,β€¦βŸ©βŸ©: the first component is the 0-coordinate component z 0, the second is the shifted sequence.

The "cons" of a head a : |π’Ÿ| and a tail b : |π’Ÿ^∞|, as a sequence ⟨a, bβ‚€, b₁, β€¦βŸ©.

Equations
Instances For
    @[simp]
    theorem Domain.Neighborhood.Exercise618.consSeq_zero {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} (a : V.Element) (b : (iterSys V).Element) :
    consSeq a b 0 = a
    @[simp]
    theorem Domain.Neighborhood.Exercise618.consSeq_succ {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} (a : V.Element) (b : (iterSys V).Element) (k : β„•) :
    consSeq a b (k + 1) = component b k

    The inverse iso is "cons". iterProdIso⁻¹ ⟨a, b⟩ = ⟨a, bβ‚€, b₁, β€¦βŸ©.

    Bottom-element computations #

    theorem Domain.Neighborhood.Exercise618.iterBot_eq {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} :
    (iterSys V).bot = ofSeq fun (x : β„•) => V.bot

    βŠ₯ of π’Ÿ^∞ is the all-βŠ₯ sequence.

    @[simp]

    The n-th coordinate of βŠ₯ is βŠ₯.

    theorem Domain.Neighborhood.Exercise618.pair_bot {Ξ± : Type u_2} {Ξ² : Type u_3} {Vβ‚€ : NeighborhoodSystem Ξ±} {V₁ : NeighborhoodSystem Ξ²} :
    pair Vβ‚€.bot V₁.bot = (prod Vβ‚€ V₁).bot

    βŠ₯ of a product is the pair of βŠ₯s.

    The structure isomorphism i, j as approximable maps #

    j : π’Ÿ^∞ β†’ π’Ÿ Γ— π’Ÿ^∞, the splitting iso (iterProdIso).

    Equations
    Instances For

      i : π’Ÿ Γ— π’Ÿ^∞ β†’ π’Ÿ^∞, the "cons" iso (iterProdIso⁻¹); the T-algebra structure map.

      Equations
      Instances For

        j ∘ i = I on π’Ÿ Γ— π’Ÿ^∞.

        Monotonicity of the product action #

        T(Β·) = (id_π’Ÿ Γ— Β·) is monotone.

        theorem Domain.Neighborhood.Exercise618.toElementMap_le_of_le {Ξ²β‚€ : Type u_2} {β₁ : Type u_3} {Wβ‚€ : NeighborhoodSystem Ξ²β‚€} {W₁ : NeighborhoodSystem β₁} {f g : ApproximableMap Wβ‚€ W₁} (h : f ≀ g) (x : Wβ‚€.Element) :

        Approximable maps are monotone in the map argument: f ≀ g ⟹ f(x) ≀ g(x).

        The homomorphism operator and the descent chain #

        theorem Domain.Neighborhood.Exercise618.descOp_apply {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (f : ApproximableMap (iterSys V) E) (z : (iterSys V).Element) :
        (descOp k f).toElementMap z = k.toElementMap (pair (component z 0) (f.toElementMap (ofSeq fun (n : β„•) => component z (n + 1))))

        The defining action of the operator: Op(f)(z) = k(zβ‚€, f(⟨z₁,zβ‚‚,β€¦βŸ©)).

        theorem Domain.Neighborhood.Exercise618.descOp_mono {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) {f f' : ApproximableMap (iterSys V) E} (h : f ≀ f') :

        The bottom map is below everything.

        theorem Domain.Neighborhood.Exercise618.descSeq_mono_succ {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (n : β„•) :
        descSeq k n ≀ descSeq k (n + 1)
        theorem Domain.Neighborhood.Exercise618.descSeq_mono {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) {n m : β„•} (h : n ≀ m) :
        theorem Domain.Neighborhood.Exercise618.descSeq_dir {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (i j : β„•) :
        βˆƒ (l : β„•), (βˆ€ (X : Set (β„• Γ— Ξ±)) (Y : Set Ξ³), (descSeq k i).rel X Y β†’ (descSeq k l).rel X Y) ∧ βˆ€ (X : Set (β„• Γ— Ξ±)) (Y : Set Ξ³), (descSeq k j).rel X Y β†’ (descSeq k l).rel X Y

        The descent map h = ⋃ₙ hβ‚™ : π’Ÿ^∞ β†’ E.

        Equations
        Instances For
          theorem Domain.Neighborhood.Exercise618.descMap_toElementMap {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (z : (iterSys V).Element) {Y : Set Ξ³} :
          ((descMap k).toElementMap z).mem Y ↔ βˆƒ (n : β„•), ((descSeq k n).toElementMap z).mem Y

          Generic chain helpers #

          theorem Domain.Neighborhood.Exercise618.chain_le_of_succ {Ξ² : Type u_2} {W : NeighborhoodSystem Ξ²} {a : β„• β†’ W.Element} (h : βˆ€ (n : β„•), a n ≀ a (n + 1)) {i j : β„•} (hij : i ≀ j) :
          a i ≀ a j

          A successor-increasing chain is increasing.

          theorem Domain.Neighborhood.Exercise618.succChainDir {Ξ² : Type u_2} {W : NeighborhoodSystem Ξ²} (a : β„• β†’ W.Element) (h : βˆ€ (n : β„•), a n ≀ a (n + 1)) (i j : β„•) :
          βˆƒ (l : β„•), a i ≀ a l ∧ a j ≀ a l

          Directedness of a successor-increasing chain.

          theorem Domain.Neighborhood.Exercise618.descSeqEltMono {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (x : (iterSys V).Element) (n : β„•) :

          The descent chain is increasing element-wise.

          theorem Domain.Neighborhood.Exercise618.descMap_eq {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (x : (iterSys V).Element) :

          The descent map as a directed union. h(x) = ⋃ₙ hβ‚™(x).

          def Domain.Neighborhood.Exercise618.kHead {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (a : V.Element) :

          The continuity helper k(a, Β·) : E β†’ E as an approximable map.

          Equations
          Instances For
            theorem Domain.Neighborhood.Exercise618.kHead_apply {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (a : V.Element) (u : E.Element) :

            The fixed-point equation h = k ∘ T(h) ∘ j #

            theorem Domain.Neighborhood.Exercise618.descMap_fix {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) :

            The descent map is a fixed point of Op = k ∘ T(·) ∘ j.

            Strictness of the descent map #

            The homomorphism square h ∘ i = k ∘ T(h) #

            Existence of the algebra homomorphism. The descent map makes the square commute: descMap ∘ i = k ∘ T(descMap) (using j ∘ i = I and the fixed-point equation).

            The truncation chain ρₙ and ⋃ₙ ρₙ = I #

            The descent chain for the structure map i itself, ρₙ = (descSeq i)β‚™ : π’Ÿ^∞ β†’ π’Ÿ^∞, truncates a sequence to its first n coordinates. Its supremum is the identity (iSupRho_eq_id), the key fact behind uniqueness: every strict homomorphism is determined on the finite truncations.

            theorem Domain.Neighborhood.Exercise618.rho_apply {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} (n : β„•) (z : (iterSys V).Element) :
            (descSeq (imap V) n).toElementMap z = ofSeq fun (i : β„•) => if i < n then component z i else V.bot

            The truncation formula ρₙ(⟨xβ‚€,x₁,β€¦βŸ©) = ⟨xβ‚€,…,x_{n-1},βŠ₯,βŠ₯,β€¦βŸ©.

            ⋃ₙ ρₙ = I. Every z is the directed union of its truncations: the cofinite-Ξ” structure of π’Ÿ^∞ means each neighbourhood of z is already realised by a finite truncation.

            Uniqueness of strict homomorphisms #

            The descent chain for any strict g starts at the constant βŠ₯: g ∘ ρ₀ = βŠ₯.

            theorem Domain.Neighborhood.Exercise618.gcomp_rho_succ {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) (g : ApproximableMap (iterSys V) E) (hc : g.comp (imap V) = k.comp (prodMap (ApproximableMap.idMap V) g)) (n : β„•) :
            g.comp (descSeq (imap V) (n + 1)) = descOp k (g.comp (descSeq (imap V) n))

            g-independence step. If g is a homomorphism (g ∘ i = k ∘ T(g)) then g ∘ Οβ‚™β‚Šβ‚ = k ∘ T(g ∘ ρₙ) ∘ j = Op_k(g ∘ ρₙ): the composite depends only on g ∘ ρₙ.

            theorem Domain.Neighborhood.Exercise618.comm_unique {Ξ± : Type u_1} {V : NeighborhoodSystem Ξ±} {Ξ³ : Type u_2} {E : NeighborhoodSystem Ξ³} (k : ApproximableMap (prod V E) E) {g g' : ApproximableMap (iterSys V) E} (hg : Exercise510.IsStrict g) (hg' : Exercise510.IsStrict g') (hc : g.comp (imap V) = k.comp (prodMap (ApproximableMap.idMap V) g)) (hc' : g'.comp (imap V) = k.comp (prodMap (ApproximableMap.idMap V) g')) :
            g = g'

            Uniqueness. Any two strict homomorphisms g, g' : π’Ÿ^∞ β†’ E into a T-algebra (E,k) are equal. By g-independence they agree on every truncation (g ∘ ρₙ = g' ∘ ρₙ), and ⋃ₙ ρₙ = I forces g = g'.

            The endofunctor T(X) = π’Ÿ Γ— X and π’Ÿ^∞ as its initial algebra #

            We package the analysis into the bespoke category StrictDomainObj of βˆ…-free domains and strict maps (Exercise 6.17), exactly the setting in which IsInitial expresses Scott's universal property. The fixed domain π’Ÿ is an arbitrary StrictDomainObj.

            theorem Domain.Neighborhood.Exercise618.isStrict_prodMap {Ξ± : Type u_2} {Ξ² : Type u_3} {Ξ±' : Type u_4} {Ξ²' : Type u_5} {Vβ‚€ : NeighborhoodSystem Ξ±} {V₁ : NeighborhoodSystem Ξ²} {Vβ‚€' : NeighborhoodSystem Ξ±'} {V₁' : NeighborhoodSystem Ξ²'} {fβ‚€ : ApproximableMap Vβ‚€ Vβ‚€'} {f₁ : ApproximableMap V₁ V₁'} (hfβ‚€ : Exercise510.IsStrict fβ‚€) (hf₁ : Exercise510.IsStrict f₁) :
            Exercise510.IsStrict (prodMap fβ‚€ f₁)

            T(fβ‚€ Γ— f₁) is strict when both factors are: (fβ‚€ Γ— f₁)(βŠ₯,βŠ₯) = (fβ‚€ βŠ₯, f₁ βŠ₯) = (βŠ₯,βŠ₯).

            The fixed domain π’Ÿ times an object X, again an βˆ…-free domain.

            Equations
            Instances For

              The product endofunctor T(X) = π’Ÿ Γ— X on βˆ…-free domains and strict maps, for a fixed domain π’Ÿ. On objects T(X) = π’Ÿ Γ— X; on maps T(f) = id_π’Ÿ Γ— f.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                π’Ÿ^∞ (Exercise 3.16's iterSys) as an βˆ…-free object.

                Equations
                Instances For

                  π’Ÿ^∞ as a T-algebra, (π’Ÿ^∞, i) with i : π’Ÿ Γ— π’Ÿ^∞ β†’ π’Ÿ^∞ the "cons" iso (imap, Exercise 3.16's iterProdIso⁻¹), strict by isStrict_imap.

                  Equations
                  Instances For

                    The descent homomorphism (π’Ÿ^∞, i) β†’ (E, k): the strict map descMap k (existence half), with the homomorphism square supplied by descMap_comm.

                    Equations
                    Instances For

                      Exercise 6.18 (initial-algebra half) β€” π’Ÿ^∞ is the initial T-algebra for T(X) = π’Ÿ Γ— X. For every T-algebra (E, k) the descent map h(⟨xβ‚€,x₁,β€¦βŸ©) = k(xβ‚€, k(x₁, …)) is the unique strict homomorphism π’Ÿ^∞ β†’ E. Together with Exercise 3.16's π’Ÿ^∞ β‰… π’Ÿ Γ— π’Ÿ^∞ (the domain-equation half), this exhibits π’Ÿ^∞ both as the canonical solution of the domain equation and as the initial algebra (determined up to iso by Proposition 6.6).

                      Equations
                      Instances For