Documentation

LeanPool.DomainTheory.Neighborhood.Exercise516ThueMorse

Exercise 5.16 follow-up (Scott 1981, PRG-19, Lecture V) — the Thue–Morse #

sequence t

The unfinished tail of Exercise 5.16. Returning to the domain C of finite/infinite binary sequences (Example 4.4), Scott studies the element

t = 0·merge(neg t, tail t),

the least fixed point of Φ(x) = 0·merge(neg x, tail x), and (Lambek's observation) identifies its n-th digit with the parity of the binary digits of n — the Thue–Morse sequence.

This module formalizes:

The tElt data is choice-free; the Prop-level digit facts may use Classical.choice (through the project's eq_of_toElementMap_principal and the truth-domain primitives), exactly like the existing uniqueness lemmas. Overlap-freeness (property (b)) is a self-contained word-combinatorics theorem and lives in its own module.

The Thue–Morse morphism expand (0 ↦ 01, 1 ↦ 10). #

The Thue–Morse substitution applied letterwise: each bit b is replaced by b (¬b).

Equations
Instances For

    expand distributes over append (it is a monoid morphism Σ* → Σ*).

    Φ on a partial element computes by interleaving — and equals expand. #

    The second (total/partial-flag) component of an interleaving with a partial first input is always false: a partial input keeps the output partial.

    The interleaving of h :: flip ρ with ρ (both starting after a common head h) is h :: expand ρ. This is the heart of why Φ is the Thue–Morse morphism on the trajectory.

    Exercise 5.16 (the operator Φ). Φ(x) = 0·merge(neg x, tail x) as an approximable map.

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

      The value of Φ on a partial element σ⊥ is (0 · weave σ)⊥, the leading 0 prepended to the interleaving of (flip σ)⊥ and (tail σ)⊥.

      The Thue–Morse trajectory. On a partial element whose string starts with 0, Φ acts as the Thue–Morse morphism expand.

      The finite approximants of the least fixed point are the morphism #

      iterates.

      The base of the iterated bottom element: f⁰(⊥) = ⊥.

      A one-step unfolding of the iterated bottom element: fⁿ⁺¹(⊥) = f(fⁿ(⊥)).

      Every iterate of expand from [0] starts with 0 (so Φ keeps acting as expand).

      ⊥ = []⊥ in C (the cone of Λ is the master).

      Exercise 5.16 (the approximants). The (k+1)-st approximant of the least fixed point is the partial element of the k-fold Thue–Morse morphism iterate of [0]: Φᵏ⁺¹(⊥) = (expandᵏ[0])⊥.

      The parity bit-function tm and its prefixes. #

      The Thue–Morse bit-function: tm n = ⊕(binary digits of n), the parity of the number of 1s in the binary expansion of n (Lambek's description).

      Equations
      Instances For

        The even recurrence tm (2n) = tm n (appending a 0-digit does not change the parity).

        The odd recurrence tm (2n+1) = ¬ tm n (appending a 1-digit flips the parity).

        Thue–Morse prefixes are nested in the prefix order.

        The morphism step on prefixes. expand (tmList m) = tmList (2m): applying the Thue–Morse morphism to a length-m prefix yields the length-2m prefix — this is exactly the even/odd parity recurrence in disguise.

        The bridge. The k-fold morphism iterate of [0] is the Thue–Morse parity prefix of length 2ᵏ: expandᵏ[0] = tmList (2ᵏ).

        Step 0 — the element t and its unfolding. #

        Exercise 5.16 (Scott 1981, PRG-19). Scott's Thue–Morse element t = 0·merge(neg t, tail t), the least fixed point of Φ.

        Equations
        Instances For

          Property (a) — the digit characterization. #

          (strBot τ) has the cone of σ as a neighbourhood iff σ is a prefix of τ.

          Each approximant is below the least fixed point.

          Property (a), prefix form. Every Thue–Morse parity prefix is a prefix of t: (tmList n)⊥ ⊑ t for all n.

          Property (a) (Scott 1981, PRG-19; Lambek). The finite-prefix characterization of t: a string σ is a prefix of t iff it is the length-σ.length Thue–Morse parity prefix. Reading off position n, the n-th digit of t is tm n, the parity of the binary digits of n.

          Property (a), digit form. The n-th digit of t is tm n (the parity of the binary digits of n): the length-(n+1) prefix of t is tmList n ++ [tm n].