Documentation

LeanPool.DomainTheory.Neighborhood.Exercise514

Exercise 5.14 (Scott 1981, PRG-19, Lecture V) — the graph model #

Using the pairing function of Exercise 5.13, code finite sequences by [n₀, …, n_k] = num(n₀, [n₁, …, n_k]) and define

fun(u)(x) = {m ∣ ∃ n₀ … n_{k-1} ∈ x, [n₀+1, …, n_{k-1}+1, 0, m] ∈ u}, graph(f) = {[n₀+1, …, n_{k-1}+1, 0, m] ∣ m ∈ f({n₀, …, n_{k-1}})}.

Show fun ∘ graph = λf.f (for continuous f) and graph ∘ fun ⊇ λx.x.

Following Exercises 4.17 and 5.13, the power-set domain is modelled by the complete lattice (Set ℕ, ⊆).

The coding #

The decisive device is the tag tag [n₀, …, n_{k-1}] m = [n₀+1, …, n_{k-1}+1, 0, m] = num(n₀+1, … num(n_{k-1}+1, num(0, m))…), defined by

tag [] m = num 0 m, tag (n :: ns) m = num (n+1) (tag ns m).

It is a bijection (List ℕ) × ℕ ≃ ℕ: injectivity (tag_injective) is an induction using num_injective, and surjectivity (tag_surjective) is strong induction on the value, decreasing because num (n+1) b > b (num_succ_left_gt) — the head's first coordinate is either 0 (stop, emit m) or ≥ 1 (peel one entry and recurse on a strictly smaller code).

The maps #

With entries ns = {n ∣ n ∈ ns} the finite set of entries of a list:

fun ∘ graph = id holds only for continuous maps, captured by IsApprox f := Monotone f ∧ (finite approximation). We prove:

Everything is choice-free (#print axioms ⊆ {propext, Quot.sound}).

A strict lower bound for num #

num (n+1) b strictly exceeds its second argument: this is what makes the decode recursion terminate. num (n+1) b = T(n+1+b) + b ≥ (n+b+1) + b > b.

The tag: coding (List ℕ) × ℕ as #

tag [n₀, …, n_{k-1}] m = [n₀+1, …, n_{k-1}+1, 0, m], built from the pairing function num.

Equations
Instances For
    @[simp]
    theorem Domain.Neighborhood.Exercise514.tag_cons (n : ) (ns : List ) (m : ) :
    tag (n :: ns) m = Exercise513.num (n + 1) (tag ns m)
    theorem Domain.Neighborhood.Exercise514.tag_injective {ns₁ ns₂ : List } {m₁ m₂ : } :
    tag ns₁ m₁ = tag ns₂ m₂ns₁ = ns₂ m₁ = m₂

    The tag is one-one, jointly in both arguments (induction on the list + num_injective).

    theorem Domain.Neighborhood.Exercise514.tag_surjective (c : ) :
    ∃ (ns : List ) (m : ), tag ns m = c

    The tag is onto: every c : ℕ decodes as some tag ns m. Strong induction on c, decreasing via num_succ_left_gt.

    The maps fun and graph #

    The finite set of entries of a list, as a subset of .

    Equations
    Instances For

      fun(u)(x) — apply the "function coded by u" to argument x.

      Equations
      Instances For

        graph(f) — the code of the function f.

        Equations
        Instances For

          A map f : Pω → Pω is approximable (continuous) when it is monotone and every output is already produced by a finite subset of the input. The finite subsets of x are exactly the entries ns with all entries in x.

          Monotonicity is phrased as an explicit -implication rather than Monotone f: on Set the order resolves through the CompleteLattice instance whose construction uses Classical.choice, so the Monotone-based statement would not be choice-free. The two are definitionally equal.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Domain.Neighborhood.Exercise514.Fun_Graph {f : Set Set } (hf : IsApprox f) (x : Set ) :
            Fun (Graph f) x = f x

            fun ∘ graph = λf.f for continuous f: Fun (Graph f) x = f x.

            graph ∘ fun ⊇ λx.x: u ⊆ Graph (Fun u).

            Every Fun u is itself approximable, so fun really lands in the continuous maps.