Documentation

LeanPool.DomainTheory.Neighborhood.Proposition77

Proposition 7.7 (Scott 1981, PRG-19, §7) — D^§ is effectively given #

Following Dana Scott, Lectures on a Mathematical Theory of Computation, PRG-19, Lecture VII.

Proposition 7.7. For any effectively given domain D, the domain D^§ is also effectively given, and all the combinators of Example 6.1 prove to be computable.

Scott transposes everything back to and gives the enumeration of D^§ (Example 6.1's tree algebra, Example61.Dsharp) by a course-of-values recursion. In our model D^§ lives over List Bool × α (Example 6.1), so the enumeration is V : ℕ → Set (List Bool × α):

Here p n = n.unpair.1 and q n = n.unpair.2 are Scott's p, q (inverse pairing): both are ≤ n, hence the subscripts p n, q n of V_{2n+2} are < 2n+2, so the recursion is well-founded and membership stays recursive — exactly Scott's observation.

This file builds the construction in milestones:

A left bound for Nat.unpair (local, to keep Recursive.lean's cache #

warm).

n.unpair.1 ≤ n (choice-free); the decreasing measure for Vsharp's left child.

theorem Domain.Neighborhood.Proposition77.nat_shape (n : ) :
n = 0 (∃ (a : ), n = 2 * a + 1) ∃ (a : ), n = 2 * a + 2

The three index shapes: 0 (master Γ), 2a+1 (leaf), 2a+2 (node). Choice-free.

Nat.pair is strictly monotone on strict componentwise order. #

Needed so the node∩node recursive child code pair (a.1) (b.1) is < pair (2a+2) (2b+2), hence present in the memo table. Proof via max² ≤ pair _ _ < (max+1)².

theorem Domain.Neighborhood.Proposition77.pair_lt_pair_of_lt {x y i j : } (hx : x < i) (hy : y < j) :

The enumeration V : ℕ → 𝒫(List Bool × α). #

@[irreducible]

Proposition 7.7 (Scott 1981, PRG-19). Scott's enumeration of D^§: V₀ = Γ, V_{2n+1} = 0·Xₙ, V_{2n+2} = 1·V_{p n} ∪ 2·V_{q n} (p = unpair.1, q = unpair.2).

Equations
Instances For
    theorem Domain.Neighborhood.Proposition77.Vsharp_succ {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (k : ) :
    Vsharp D P (k + 1) = if (k + 1) % 2 = 1 then Example61.embZero (P.X (k / 2)) else Example61.embPair (Vsharp D P (Nat.unpair ((k - 1) / 2)).1) (Vsharp D P (Nat.unpair ((k - 1) / 2)).2)

    One-step unfolding of Vsharp at a successor index.

    mem_X, surj, nonemptiness. #

    Every V k is a neighbourhood of D^§.

    theorem Domain.Neighborhood.Proposition77.Vsharp_surj {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) {W : Set (List Bool × α)} (hW : Example61.MemS D W) :
    ∃ (k : ), Vsharp D P k = W

    Every neighbourhood of D^§ is enumerated as some V k (surjectivity of V).

    theorem Domain.Neighborhood.Proposition77.Vsharp_nonempty {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (k : ) :

    Under ∅ ∉ 𝒟, no V k is empty.

    Per-parity intersection identities. #

    These are the choice-free heart of Scott's "the reader has to check that 7.1(i)–(ii) hold for the Vₖ. The idea is that any such check is either (1) trivial, or (2) something already assumed about D and the Xₙ, or (3) can be thrown back to some sets Vₘ with strictly smaller subscripts."

    MemS-subset inversions and the consistency-via-subset equivalences. #

    A nonempty D^§-neighbourhood contained in embZero Y must itself be an embZero (its tokens have empty {1,2}-path); contained in embPair A B, an embPair. These give the bridge between Scott's consistency relation on D^§ (∃ l, V_l ⊆ V_n ∩ V_m) and the recursive sub-checks: embZero consistency reduces to D's, and embPair consistency to the two components'.

    theorem Domain.Neighborhood.Proposition77.memS_sub_embZero {α : Type u_1} {D : NeighborhoodSystem α} (hD : ∀ (X : Set α), D.mem XX.Nonempty) {W : Set (List Bool × α)} {Y : Set α} (hW : Example61.MemS D W) (hsub : W Example61.embZero Y) :
    ∃ (Z : Set α), D.mem Z W = Example61.embZero Z
    theorem Domain.Neighborhood.Proposition77.memS_sub_embPair {α : Type u_1} {D : NeighborhoodSystem α} (hD : ∀ (X : Set α), D.mem XX.Nonempty) {W A B : Set (List Bool × α)} (hW : Example61.MemS D W) (hsub : W Example61.embPair A B) :
    ∃ (Pp : Set (List Bool × α)) (Qq : Set (List Bool × α)), Example61.MemS D Pp Example61.MemS D Qq W = Example61.embPair Pp Qq
    theorem Domain.Neighborhood.Proposition77.exists_sub_embZero_iff {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (Y : Set α) :
    (∃ (l : ), Vsharp D P l Example61.embZero Y) ∃ (k : ), P.X k Y
    theorem Domain.Neighborhood.Proposition77.exists_sub_embPair_iff {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (A B : Set (List Bool × α)) :
    (∃ (l : ), Vsharp D P l Example61.embPair A B) (∃ (l : ), Vsharp D P l A) ∃ (l : ), Vsharp D P l B
    theorem Domain.Neighborhood.Proposition77.Vsharp_eq_Gamma_iff {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (j : ) :

    A primitive-recursive course-of-values memo evaluator. #

    The D^§ deciders (cons, inter, equality) recurse on the index trees: e.g. inter(2a+2, 2b+2) recurses on inter(a.1, b.1) and inter(a.2, b.2). The combined measure w = Nat.pair n m strictly decreases on every recursive call, so each decider is a unary course-of-values recursion on w. We realise course-of-values by a primitive-recursive memo table: rtbl step w codes the reverse list [g(w-1), …, g 0] (g v = step (pair v (table for v))), built by a single Nat.Primrec.prec whose step is a cons. To read g v for v < w inside step, we look up position w-1-v of the reverse table via listGet. All choice-free.

    One step of the list-indexing fold: state pair countdown value; capture the current element when countdown = 1, else carry the value and decrement.

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

      listGet c i = (decodeList c).getD i 0: the i-th entry of the list coded by c.

      Equations
      Instances For

        Correctness of listGet on a coded list.

        listGet is primitive recursive (on the Nat.pair coding of c, i).

        The reverse memo table: rtbl step w codes [g(w-1), …, g 0].

        Equations
        Instances For

          The course-of-values value at w: g w = step (pair w (table of g below w)).

          Equations
          Instances For
            theorem Domain.Neighborhood.Proposition77.gOf_def (step : ) (w : ) :
            gOf step w = step (Nat.pair w (rtbl step w))
            theorem Domain.Neighborhood.Proposition77.getD_gList (step : ) (w p : ) :
            p < w(gList step w).getD p 0 = gOf step (w - 1 - p)
            theorem Domain.Neighborhood.Proposition77.listGet_rtbl (step : ) {v w : } (hv : v < w) :
            listGet (rtbl step w) (w - 1 - v) = gOf step v

            The course-of-values lookup. Inside step at w, position w-1-v of the reverse table is exactly g v, for any earlier v < w.

            rtbl step is primitive recursive when step is (a single prec whose step is a cons).

            gOf step is primitive recursive when step is.

            theorem Domain.Neighborhood.Proposition77.primrec_listGet₂ {c i : } (hc : Nat.Primrec c) (hi : Nat.Primrec i) :
            Nat.Primrec fun (p : ) => listGet (c p) (i p)

            listGet as a binary primrec composite.

            The combined D^§ decider step (eq/cons/inter triple). #

            All three D^§ deciders recurse the same way on (i, j), so we compute them together as a packed triple packT eqBit consBit interIdx. The step dsharpStep fcons feq finter is fed Scott's three D-level primitive-recursive functions: fcons/feq are the extracted {0,1} characteristic functions of P.cons_computable/P.eq_computable, and finter is P.inter (on Nat.pair codes). The combined index is w = Nat.pair i j; in the node∩node case the children's results are read from the memo table by listGet.

            Pack the triple (eqBit, consBit, interIdx) into one natural.

            Equations
            Instances For

              Equality bit of a packed triple.

              Equations
              Instances For

                Consistency bit of a packed triple.

                Equations
                Instances For

                  Intersection index of a packed triple.

                  Equations
                  Instances For
                    @[simp]
                    @[simp]
                    def Domain.Neighborhood.Proposition77.dsharpStep (fcons feq finter : ) (p : ) :

                    The D^§ decider step. p = pair (pair i j) tbl. Returns packT eqBit consBit interIdx, case-splitting on i = 0 / j = 0 (the Γ identity), then on parities (leaf 2a+1 vs node 2a+2). Leaf∩leaf delegates to D's deciders; node∩node ANDs/combines the two children read from the memo table tbl.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_i0 (fcons feq finter : ) (j tbl : ) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair 0 j) tbl) = packT (1 - j) 1 j
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_j0 (fcons feq finter : ) {i : } (tbl : ) (hi : i 0) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair i 0) tbl) = packT (1 - i) 1 i
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_ll (fcons feq finter : ) (a b tbl : ) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 1) (2 * b + 1)) tbl) = packT (feq (Nat.pair a b)) (fcons (Nat.pair a b)) (2 * finter (Nat.pair a b) + 1)
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_ln (fcons feq finter : ) (a b tbl : ) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 1) (2 * b + 2)) tbl) = packT 0 0 0
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_nl (fcons feq finter : ) (a b tbl : ) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 2) (2 * b + 1)) tbl) = packT 0 0 0
                      theorem Domain.Neighborhood.Proposition77.dsharpStep_nn (fcons feq finter : ) (a b tbl : ) :
                      dsharpStep fcons feq finter (Nat.pair (Nat.pair (2 * a + 2) (2 * b + 2)) tbl) = packT (eqB (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).1 (Nat.unpair b).1)) * eqB (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).2 (Nat.unpair b).2))) (consB (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).1 (Nat.unpair b).1)) * consB (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).2 (Nat.unpair b).2))) (2 * Nat.pair (intI (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).1 (Nat.unpair b).1))) (intI (listGet tbl (Nat.pair (2 * a + 2) (2 * b + 2) - 1 - Nat.pair (Nat.unpair a).2 (Nat.unpair b).2))) + 2)
                      theorem Domain.Neighborhood.Proposition77.primrec_dsharpStep (fcons feq finter : ) (hfcons : Nat.Primrec fcons) (hfeq : Nat.Primrec feq) (hfinter : Nat.Primrec finter) :
                      Nat.Primrec (dsharpStep fcons feq finter)

                      The decider step is primitive recursive when the D-level functions are.

                      Correctness of the decider step (strong induction on the combined code). #

                      Given that fcons/feq/finter correctly decide D-consistency / D-equality / D-intersection, the packed triple gOf (dsharpStep …) correctly decides D^§-consistency, computes the D^§-intersection index, and decides D^§-equality. Proved together by strong induction on the combined code Nat.pair i j; the node∩node case recurses to strictly smaller codes (present in the memo table by pair_lt_pair_of_lt).

                      theorem Domain.Neighborhood.Proposition77.dsharp_decider_spec {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (fcons feq finter : ) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (hcons : ∀ (a b : ), fcons (Nat.pair a b) = 1 ∃ (l : ), P.X l P.X a P.X b) (heq : ∀ (a b : ), feq (Nat.pair a b) = 1 P.X a = P.X b) (hinter : ∀ (a b : ), (∃ (l : ), P.X l P.X a P.X b)P.X (finter (Nat.pair a b)) = P.X a P.X b) (i j : ) :
                      (consB (gOf (dsharpStep fcons feq finter) (Nat.pair i j)) = 1 ∃ (l : ), Vsharp D P l Vsharp D P i Vsharp D P j) ((∃ (l : ), Vsharp D P l Vsharp D P i Vsharp D P j)Vsharp D P (intI (gOf (dsharpStep fcons feq finter) (Nat.pair i j))) = Vsharp D P i Vsharp D P j) (eqB (gOf (dsharpStep fcons feq finter) (Nat.pair i j)) = 1 Vsharp D P i = Vsharp D P j)
                      theorem Domain.Neighborhood.Proposition77.dsharp_intI_correct {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (fcons feq finter : ) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (hinter : ∀ (a b : ), (∃ (l : ), P.X l P.X a P.X b)P.X (finter (Nat.pair a b)) = P.X a P.X b) (i j : ) :
                      (∃ (l : ), Vsharp D P l Vsharp D P i Vsharp D P j)Vsharp D P (intI (gOf (dsharpStep fcons feq finter) (Nat.pair i j))) = Vsharp D P i Vsharp D P j

                      Intersection-index correctness in isolation. The intI component of gOf (dsharpStep …) is independent of the eq/cons bits (fcons/feq), so it is correct assuming only that finter correctly intersects in D. This lets the inter data field be built with dummy fcons/feq while staying choice-free.

                      theorem Domain.Neighborhood.Proposition77.dsharp_interEq_iff {α : Type u_1} {D : NeighborhoodSystem α} (P : ComputablePresentation D) (fcons feq finter : ) (hD : ∀ (X : Set α), D.mem XX.Nonempty) (hcons : ∀ (a b : ), fcons (Nat.pair a b) = 1 ∃ (l : ), P.X l P.X a P.X b) (heq : ∀ (a b : ), feq (Nat.pair a b) = 1 P.X a = P.X b) (hinter : ∀ (a b : ), (∃ (l : ), P.X l P.X a P.X b)P.X (finter (Nat.pair a b)) = P.X a P.X b) (n m k : ) :
                      Vsharp D P n Vsharp D P m = Vsharp D P k consB (gOf (dsharpStep fcons feq finter) (Nat.pair n m)) * eqB (gOf (dsharpStep fcons feq finter) (Nat.pair (intI (gOf (dsharpStep fcons feq finter) (Nat.pair n m))) k)) = 1

                      Decidability of 7.1(i) for D^§. Vₙ ∩ Vₘ = V_k iff (n,m) is consistent and the computed intersection index agrees with k under D^§-equality. Inconsistency forces the product to 0 (and then Vₙ ∩ Vₘ = ∅ ≠ V_k, since V_k is nonempty), so the single product decider is correct on the nose.

                      Proposition 7.7: D^§ is effectively given. #

                      Assembling the pieces into a ComputablePresentation (Dsharp D hD). The enumeration is Vsharp; relation 7.1(ii) (consistency) and 7.1(i) (intersection-equality) are decided by the packed-triple deciders; the primitive-recursive intersection function reads the intI component (built with dummy eq/cons bits, which it does not depend on). Choice-free: the Prop fields obtain D's existential deciders, the data fields use only P.inter (data).

                      Proposition 7.7 (Scott 1981, PRG-19). A computable presentation of D^§ from one of D.

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

                        Proposition 7.7 (Scott 1981, PRG-19). If D is effectively given, so is D^§.