Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.PolyTime.RotationMap.TowerTable

Complete rotation tables for the zig-zag tower #

Build a table one level at a time using two previous-table lookups and two fixed-base rotations. Each row stores the neighboring vertex and return label for every fixed edge label. Arithmetic numbering agrees with the existing mathematical tower. Resource certificates live separately in Computability/Machines/Turing/MultiTape/Complexity/PolyTime/RotationMap/Tower.

Main definitions #

Main results #

References #

@[reducible, inline]

A complete rotation table: a row for each numbered vertex and each fixed edge label.

def Cslib.RotationMap.TowerTable.lookup {D : Type} (table : TowerTable D) (vertex : ℕ) (label : D × D) :
ℕ × D × D

Read a rotation, returning vertex zero with the same label for an out-of-range row.

Every stored neighbor is a valid vertex of the table.

The fixed base, squared, gives the initial rotation table.

def Cslib.RotationMap.TowerTable.nextRow {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (table : TowerTable D) (vertex : ℕ) (label : D × D) :
ℕ × D × D

A row of the next square-and-zig-zag level, with arithmetic vertex numbering.

def Cslib.RotationMap.TowerTable.next {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (table : TowerTable D) :

Construct every row of the next level from the preceding table.

def Cslib.RotationMap.TowerTable.build {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (size : ℕ) :

Construct the tower level selected by the ceiling logarithm of the requested size.

@[simp]

The initial table has one row for each of the b base vertices.

@[simp]
theorem Cslib.RotationMap.TowerTable.length_next {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (table : TowerTable D) :
List.length (next H e hb table) = List.length table * b

The next level has b rows for each row of the table.

The initial table stores valid neighbors.

theorem Cslib.RotationMap.TowerTable.Valid.lookup_lt {D : Type} {table : TowerTable D} (h : table.Valid) {vertex : ℕ} (hv : vertex < List.length table) (label : D × D) :
(table.lookup vertex label).1 < List.length table

Lookup at a valid row returns a valid neighbor.

theorem Cslib.RotationMap.TowerTable.Valid.next {D : Type} {b : ℕ} {table : TowerTable D} (h : table.Valid) (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) :
(TowerTable.next H e hb table).Valid

One complete level preserves the range of every neighbor.

theorem Cslib.RotationMap.TowerTable.length_iterate {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (level : ℕ) :
List.length ((next H e hb)^[level] (initial H)) = b ^ (level + 1)

The complete table after level rounds has exactly the tower's vertex count.

theorem Cslib.RotationMap.TowerTable.valid_iterate {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (level : ℕ) :
((next H e hb)^[level] (initial H)).Valid

Every intermediate level stores valid neighbor indices.

theorem Cslib.RotationMap.TowerTable.lookup_iterate_numbered {D : Type} {b : ℕ} {B : Type u_1} (H : RotationMap B D) (e : B ≃ (Fin 2 → D × D)) (numbering : B ≃ Fin b) (hb : 0 < b) (level : ℕ) (vertex : ZigzagTowerVertex B level) (label : D × D) :
((next (H.reindex numbering) (numbering.symm.trans e) hb)^[level] (initial (H.reindex numbering))).lookup (↑((ZigzagTowerVertex.equivFin numbering level) vertex)) label = (↑((ZigzagTowerVertex.equivFin numbering level) ((H.zigzagTower e level).rot (vertex, label)).1), ((H.zigzagTower e level).rot (vertex, label)).2)

A table built from a numbered base retains the original tower's exact rotation.

theorem Cslib.RotationMap.TowerTable.length_build {D : Type} {b : ℕ} (H : RotationMap (Fin b) D) (e : Fin b ≃ (Fin 2 → D × D)) (hb : 0 < b) (size : ℕ) :
List.length (build H e hb size) = b ^ (Nat.clog b size - 1 + 1)

The selected complete table has the exact cardinality used by the tower family.

theorem Cslib.RotationMap.TowerTable.lookup_build {D : Type} {b : ℕ} {B : Type u_1} (H : RotationMap B D) (e : B ≃ (Fin 2 → D × D)) (numbering : B ≃ Fin b) (hb : 0 < b) (size : ℕ) (vertex : Fin (b ^ (Nat.clog b size - 1 + 1))) (label : D × D) :
(build (H.reindex numbering) (numbering.symm.trans e) hb size).lookup (↑vertex) label = have target := ((H.zigzagTower e (Nat.clog b size - 1)).reindex (ZigzagTowerVertex.equivFin numbering (Nat.clog b size - 1))).rot (vertex, label); (↑target.1, target.2)

Reading a selected table agrees with the numbered tower, including its return label.