Documentation

CslibFrontier.Computability.PolyTime.Int.MatrixPower

Uniform polynomial-time integer matrix-power columns #

Cslib.IntTable.mulVec multiplies a stored integer row table by a stored integer vector. Its dimension is the number of rows: short rows and vectors are padded by zero, and entries past that dimension are ignored. The operation is total on ragged tables.

Cslib.IntTable.powerColumn starts with a standard basis vector and stores the complete vector after each multiplication. Its native multitape polynomial-time certificate is uniform in the table, unary iteration count, and unary seed index. Matrix and vector entries use signed binary. No bound on the dimension or the matrix entries is assumed. The proof bounds every intermediate coordinate's magnitude length by 1 + steps * (entryBits + dimension.size) and uses the native bounded-iteration rule. Thus exponentially large integer magnitudes do not become unary data.

Main results #

Multiply a stored row table by a stored vector, using the row count as the dimension. Missing entries read as zero and coordinates past that dimension are ignored.

def Cslib.IntTable.powerColumn (rows : List (List ℤ)) (steps seed : ℕ) :

Iterate stored matrix-vector multiplication from the indicated standard basis vector. An out-of-bounds seed gives the zero vector.

@[simp]
theorem Cslib.IntTable.length_mulVec (rows : List (List ℤ)) (v : List ℤ) :
(mulVec rows v).length = rows.length

Matrix-vector multiplication returns one coordinate for every stored row.

theorem Cslib.IntTable.powerColumn_succ (rows : List (List ℤ)) (steps seed : ℕ) :
powerColumn rows (steps + 1) seed = mulVec rows (powerColumn rows steps seed)

Each iteration is one multiplication of the previously stored vector.

@[simp]
theorem Cslib.IntTable.length_powerColumn (rows : List (List ℤ)) (steps seed : ℕ) :
(powerColumn rows steps seed).length = rows.length

Every stored power column has the dimension of the table.

theorem Cslib.IntTable.mulVec_ofFn {n : ℕ} (M : Matrix (Fin n) (Fin n) ℤ) (v : Fin n → ℤ) :
mulVec (List.ofFn fun (i : Fin n) => List.ofFn (M i)) (List.ofFn v) = List.ofFn fun (i : Fin n) => ∑ j : Fin n, M i j * v j

On tabulated square matrices and vectors, stored multiplication agrees with the usual finite-coordinate sum.

theorem Cslib.IntTable.powerColumn_ofFn {n : ℕ} (M : Matrix (Fin n) (Fin n) ℤ) (steps : ℕ) (i : Fin n) :
powerColumn (List.ofFn fun (j : Fin n) => List.ofFn (M j)) steps ↑i = List.ofFn fun (j : Fin n) => (M ^ steps) j i

Tabulating a finite matrix and computing a stored power column agrees with the corresponding column of its ordinary matrix power.

theorem Cslib.IntTable.size_getD_powerColumn_le {rows : List (List ℤ)} {b : ℕ} (hrows : ∀ row ∈ rows, ∀ z ∈ row, z.natAbs.size ≤ b) (steps seed i : ℕ) :
((powerColumn rows steps seed).getD i 0).natAbs.size ≤ 1 + steps * (b + rows.length.size)

With at most b magnitude bits per matrix entry, each stored coordinate has at most 1 + steps * (b + dimension.size) magnitude bits. This also bounds defaulted reads.

Multiply a uniformly computed binary-integer row table and vector in native polynomial time. The dimension is the runtime row count; no rectangularity premise is required.

Compute stored integer matrix-power columns in native polynomial time, uniformly in the binary-integer table and the unary step count and seed index.