Documentation

Complexitylib.Classes.PCP.Internal.TowerFin

The zig-zag tower, numbered #

ZigZagTower builds its members out of nested product types and names the base's vertices by an arbitrary bijection. That is enough for the mathematics, but an algorithm has to be handed numbers. This module rebuilds the tower with every vertex and dart numbered, and with each naming chosen explicitly: pairs are packed by finProdFinEquiv, so a level-k vertex is a mixed-radix numeral with k + 1 digits in base deg ^ 4.

The recursion carries its own involutivity proof, which is what lets the next level's types be Fin on the nose rather than up to a transport.

Main definitions #

Main results #

The recursion, in the open #

theorem Complexity.RegGraph.rot_power_two (G : RegGraph) (v : G.V) (s : Fin 2G.D) :
(G.power 2).rot (v, s) = ((G.rot ((G.rot (v, s 0)).1, s 1)).1, ![(G.rot ((G.rot (v, s 0)).1, s 1)).2, (G.rot (v, s 0)).2])

The rotation map of the square: walk two darts, and hand back the two return labels in the opposite order.

A zig-zag base with its vertices and darts numbered: deg ^ 4 vertices, deg darts, and a spectral bound of a fifth.

Instances For

    The base graph.

    Equations
    Instances For
      @[simp]

      The number of vertices at level k.

      Equations
      Instances For
        theorem Complexity.FinBase.size_succ (F : FinBase) (k : ) :
        F.size (k + 1) = F.size k * F.deg ^ 4

        The numbered base is a zig-zag base.

        Equations
        • F.toBase = { base := F.graph, card_eq := , lam := F.lam, lam_nonneg := , lam_le := , spectral := }
        Instances For

          The chosen namings #

          Two darts of the base, as one dart of the level.

          Equations
          Instances For
            def Complexity.FinBase.baseName (F : FinBase) :
            Fin (F.deg ^ 4) (Fin 2Fin (F.deg ^ 2))

            The base's vertices name the pairs of darts of a level.

            Equations
            Instances For
              def Complexity.FinBase.vertName (F : FinBase) (k : ) :
              Fin (F.size k) × (Fin 2Fin (F.deg ^ 2)) Fin (F.size (k + 1))

              A level-k vertex together with a base vertex, as a level-(k+1) vertex.

              Equations
              Instances For

                The two darts of the squared base, as one.

                Equations
                Instances For

                  The squared base's vertices, numbered as level zero's.

                  Equations
                  Instances For

                    The namings, in numbers #

                    @[simp]
                    theorem Complexity.FinBase.val_dartName (F : FinBase) (a b : Fin F.deg) :
                    (F.dartName (a, b)) = b + F.deg * a
                    @[simp]
                    theorem Complexity.FinBase.val_dartName_symm_fst (F : FinBase) (i : Fin (F.deg ^ 2)) :
                    (F.dartName.symm i).1 = i / F.deg
                    @[simp]
                    theorem Complexity.FinBase.val_dartName_symm_snd (F : FinBase) (i : Fin (F.deg ^ 2)) :
                    (F.dartName.symm i).2 = i % F.deg
                    @[simp]
                    theorem Complexity.FinBase.val_baseName_zero (F : FinBase) (x : Fin (F.deg ^ 4)) :
                    (F.baseName x 0) = x / F.deg ^ 2
                    @[simp]
                    theorem Complexity.FinBase.val_baseName_one (F : FinBase) (x : Fin (F.deg ^ 4)) :
                    (F.baseName x 1) = x % F.deg ^ 2
                    @[simp]
                    theorem Complexity.FinBase.val_baseName_symm (F : FinBase) (s : Fin 2Fin (F.deg ^ 2)) :
                    (F.baseName.symm s) = (s 1) + F.deg ^ 2 * (s 0)
                    @[simp]
                    theorem Complexity.FinBase.val_vertName (F : FinBase) (k : ) (u : Fin (F.size k)) (s : Fin 2Fin (F.deg ^ 2)) :
                    ((F.vertName k) (u, s)) = (F.baseName.symm s) + F.deg ^ 4 * u
                    @[simp]
                    theorem Complexity.FinBase.val_vertName_symm_fst (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) :
                    ((F.vertName k).symm v).1 = v / F.deg ^ 4
                    @[simp]
                    theorem Complexity.FinBase.val_vertName_symm_snd_zero (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) :
                    (((F.vertName k).symm v).2 0) = v % F.deg ^ 4 / F.deg ^ 2
                    @[simp]
                    theorem Complexity.FinBase.val_vertName_symm_snd_one (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) :
                    (((F.vertName k).symm v).2 1) = v % F.deg ^ 4 % F.deg ^ 2
                    theorem Complexity.FinBase.val_baseName_symm_vertName_symm (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) :
                    (F.baseName.symm ((F.vertName k).symm v).2) = v % F.deg ^ 4
                    @[simp]
                    theorem Complexity.FinBase.val_zeroVertName (F : FinBase) (x : Fin (F.deg ^ 4)) :
                    (F.zeroVertName x) = x
                    @[simp]
                    @[simp]
                    theorem Complexity.FinBase.val_zeroDartName (F : FinBase) (s : Fin 2Fin F.deg) :
                    (F.zeroDartName s) = (s 1) + F.deg * (s 0)
                    @[simp]
                    theorem Complexity.FinBase.val_zeroDartName_symm_zero (F : FinBase) (i : Fin (F.deg ^ 2)) :
                    (F.zeroDartName.symm i 0) = i / F.deg
                    @[simp]
                    theorem Complexity.FinBase.val_zeroDartName_symm_one (F : FinBase) (i : Fin (F.deg ^ 2)) :
                    (F.zeroDartName.symm i 1) = i % F.deg

                    The tower #

                    noncomputable def Complexity.FinBase.data (F : FinBase) (k : ) :
                    { f : Fin (F.size k) × Fin (F.deg ^ 2)Fin (F.size k) × Fin (F.deg ^ 2) // Function.Involutive f }

                    The rotation map at each level, carrying its involutivity so that the next level's types are numbered on the nose.

                    Equations
                    Instances For
                      noncomputable def Complexity.FinBase.graphAt (F : FinBase) (k : ) :

                      The level-k graph.

                      Equations
                      Instances For
                        @[simp]
                        @[simp]
                        theorem Complexity.FinBase.deg_graphAt (F : FinBase) (k : ) :
                        (F.graphAt k).deg = F.deg ^ 2

                        One level is the zig-zag of the previous with the base, renumbered.

                        Every level has spectral bound 2 / 5.

                        theorem Complexity.FinBase.data_succ_apply (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) (i : Fin (F.deg ^ 2)) {us : Fin (F.size k) × (Fin 2Fin (F.deg ^ 2))} (hus : us = (F.vertName k).symm v) {ab : Fin F.deg × Fin F.deg} (hab : ab = F.dartName.symm i) {p : Fin (F.deg ^ 4) × Fin F.deg} (hp : p = F.rot (F.baseName.symm us.2, ab.1)) {q : Fin (F.size k) × (Fin 2Fin (F.deg ^ 2))} (hq : q = ((F.graphAt k).power 2).rot (us.1, F.baseName p.1)) {r : Fin (F.deg ^ 4) × Fin F.deg} (hr : r = F.rot (F.baseName.symm q.2, ab.2)) :
                        (F.data (k + 1)) (v, i) = ((F.vertName k) (q.1, F.baseName r.1), F.dartName (r.2, p.2))

                        One level of the recursion, in coordinates. A level-(k+1) vertex is a level-k vertex together with a base vertex, and a level-(k+1) dart is a pair of base darts; in those coordinates a step is: turn in the base, walk two darts of the level below, turn in the base again.

                        @[simp]
                        theorem Complexity.FinBase.rot_graphAt (F : FinBase) (k : ) :
                        (F.graphAt k).rot = (F.data k)
                        theorem Complexity.FinBase.data_zero_apply (F : FinBase) (v : Fin (F.size 0)) (i : Fin (F.deg ^ 2)) {s : Fin 2Fin F.deg} (hs : s = F.zeroDartName.symm i) {p₀ : Fin (F.deg ^ 4) × Fin F.deg} (h0 : p₀ = F.rot (F.zeroVertName.symm v, s 0)) {p₁ : Fin (F.deg ^ 4) × Fin F.deg} (h1 : p₁ = F.rot (p₀.1, s 1)) :
                        (F.data 0) (v, i) = (F.zeroVertName p₁.1, F.zeroDartName ![p₁.2, p₀.2])

                        The bottom of the recursion, in coordinates. Level zero is the base squared: walk two base darts, and return the labels in the opposite order.

                        theorem Complexity.FinBase.data_succ_apply' (F : FinBase) (k : ) (v : Fin (F.size (k + 1))) (i : Fin (F.deg ^ 2)) {us : Fin (F.size k) × (Fin 2Fin (F.deg ^ 2))} (hus : us = (F.vertName k).symm v) {ab : Fin F.deg × Fin F.deg} (hab : ab = F.dartName.symm i) {p : Fin (F.deg ^ 4) × Fin F.deg} (hp : p = F.rot (F.baseName.symm us.2, ab.1)) {q₀ : Fin (F.size k) × Fin (F.deg ^ 2)} (hq₀ : q₀ = (F.data k) (us.1, F.baseName p.1 0)) {q₁ : Fin (F.size k) × Fin (F.deg ^ 2)} (hq₁ : q₁ = (F.data k) (q₀.1, F.baseName p.1 1)) {r : Fin (F.deg ^ 4) × Fin F.deg} (hr : r = F.rot (F.baseName.symm ![q₁.2, q₀.2], ab.2)) :
                        (F.data (k + 1)) (v, i) = ((F.vertName k) (q₁.1, F.baseName r.1), F.dartName (r.2, p.2))

                        The step in full, with the two walks of the level below spelled out.

                        The recursion, in numbers #

                        noncomputable def Complexity.FinBase.baseVal (F : FinBase) (x a : ) :

                        The base's rotation map, on raw numbers.

                        Equations
                        Instances For
                          @[simp]
                          theorem Complexity.FinBase.baseVal_apply (F : FinBase) (x : Fin (F.deg ^ 4)) (a : Fin F.deg) :
                          F.baseVal x a = ((F.rot (x, a)).1, (F.rot (x, a)).2)
                          noncomputable def Complexity.FinBase.rotVal (F : FinBase) :
                          × ×

                          The tower's rotation map, on raw numbers. A level-(k+1) vertex v splits as v / deg^4 (the level below) and v % deg^4 (the base); a dart i splits as i / deg and i % deg. The step turns in the base, walks two darts of the level below, and turns in the base again.

                          Equations
                          Instances For
                            theorem Complexity.FinBase.rotVal_eq (F : FinBase) (k : ) (v : Fin (F.size k)) (i : Fin (F.deg ^ 2)) :
                            F.rotVal k (v, i) = (((F.data k) (v, i)).1, ((F.data k) (v, i)).2)

                            The numbers compute the tower.

                            theorem Complexity.FinBase.baseVal_lt (F : FinBase) {x a : } (hx : x < F.deg ^ 4) (ha : a < F.deg) :
                            (F.baseVal x a).1 < F.deg ^ 4 (F.baseVal x a).2 < F.deg
                            theorem Complexity.FinBase.rotVal_lt (F : FinBase) (k : ) {v i : } (hv : v < F.size k) (hi : i < F.deg ^ 2) :
                            (F.rotVal k (v, i)).1 < F.size k (F.rotVal k (v, i)).2 < F.deg ^ 2

                            Choosing a level #

                            theorem Complexity.FinBase.one_lt_pow_four (F : FinBase) (hd : 1 < F.deg) :
                            1 < F.deg ^ 4
                            theorem Complexity.FinBase.exists_size_ge (F : FinBase) (hd : 1 < F.deg) (n : ) :
                            ∃ (k : ), n F.size k
                            theorem Complexity.FinBase.le_size_self (F : FinBase) (hd : 1 < F.deg) (n : ) :
                            n F.size n
                            noncomputable def Complexity.FinBase.level (F : FinBase) (hd : 1 < F.deg) (n : ) :

                            The first level large enough for a requested size.

                            Equations
                            Instances For
                              theorem Complexity.FinBase.le_size_level (F : FinBase) (hd : 1 < F.deg) (n : ) :
                              n F.size (F.level hd n)
                              theorem Complexity.FinBase.level_le (F : FinBase) (hd : 1 < F.deg) (n : ) :
                              F.level hd n n

                              The level a size needs is at most that size.

                              theorem Complexity.FinBase.size_level_le (F : FinBase) (hd : 1 < F.deg) (n : ) (hn : 1 n) :
                              F.size (F.level hd n) F.deg ^ 4 * n

                              Numbering a base #

                              A zig-zag base, numbered.

                              Equations
                              Instances For

                                A numbered base exists.

                                theorem Complexity.exists_finBase :
                                ∃ (F : FinBase), 1 < F.deg

                                And one whose degree is above one, which is what folding a tower onto a requested size needs.