Computing exact prime-field block rank by a bit-charged Berkowitz pivot search
ProvedOCTKernel.Main.block_rank_by_charged_berkowitzbit-complexitylinear-algebramatroidsstoc
For every prime and every subset of vertex blocks in an AMR matrix, the displayed deterministic algorithm returns the exact block rank. It grows a nonsingular minor by testing bordered matrices, using the registered integer Berkowitz algorithm and reduction modulo the prime. Its displayed polynomial bound includes both successful and failed tests, matrix construction, modular reduction and the preprocessing of the block mask. The work model is the instrumented bit/array model of the integer determinant algorithm.
Preamble
import Mathlib import Definitions.Def_OCTKernel_Main_Algorithms import Definitions.Def_BipHamCount_Deterministic_Arithmetic
Formal statement
theorem OCTKernel.Main.block_rank_by_charged_berkowitz :
let app {α : Type} {k : ℕ} (v : Fin k → α) (x : α) : Fin (k+1) → α :=
Sum.elim v (fun _ : Fin 1 => x) ∘ finSumFinEquiv.symm
let search {α : Type} (test : α → Bool × ℕ) (xs : List α) :=
xs.foldr (fun x (next : Unit → Option α × ℕ) _ =>
let a := test x
if a.1 then (some x,a.2+1) else
let rest := next ()
(rest.1,a.2+1+rest.2)) (fun _ => (none,1)) ()
let grow {m n p : ℕ} (A : Matrix (Fin m) (Fin n) (ZMod p)) (fuel : ℕ) :=
Nat.rec (motive := fun _ => (k : ℕ) → (Fin k → Fin m) → (Fin k → Fin n) → ℕ × ℕ)
(fun k _ _ => (k,1)) (fun _ go k I J =>
let ps := (List.finRange m).flatMap (fun i => (List.finRange n).map (fun j => (i,j)))
let s := search (fun (i,j) =>
let M := Array.ofFn (fun r => Array.ofFn (fun c => ((A (app I i r) (app J j c)).val : ℤ)))
let z := (BipHamCount.Deterministic.berkowitz BipHamCount.Deterministic.intOps (k+1) M).run 0
let extra := (k+1+1)^2*(2*(k+1)+(p.size+1)+8)+(z.1.natAbs.size+(p.size+1)+3)^2+2
(decide ((z.1 : ZMod p) ≠ 0), z.2+extra)) ps
match s.1 with
| none => (k,s.2+(m+2*m*n+2))
| some (i,j) =>
let rest := go (k+1) (app I i) (app J j)
(rest.1,s.2+(m+2*m*n+2)+rest.2)) fuel
∀ (p n t : ℕ) [Fact p.Prime] (A : OCTKernel.Main.MatrixData p n t) (F : Finset (Fin n)),
let m : ℕ := A.rows
let d := min m (n*t)
let u := p.size+1
let prep := (m+1)*(n*t+1)*(n+1)*(m.size+n.size+t.size+p.size+8)^2
let buf := Array.ofFn (fun i => Array.ofFn (fun c : Fin (n*t) =>
let v := finProdFinEquiv.symm c
if v.1 ∈ F then A.matrix i v else 0))
let z := grow (m:=m) (n:=n*t) (fun i j => ((buf[i.val]?.getD #[])[j.val]?).getD 0)
d 0 Fin.elim0 Fin.elim0
let v := u+(d+1)*(2*u+d+4)
let bits := fun l : ℕ => 1+l*(2*v+d+4)
let g := bits (d+1)+v+u+d+5
let b := 100*(g+2)^4+8*(d+3)+16
let h := 16*(d+3)
let bw := (d+1)*(10*(h*(h*(h*b))))+b+b
let testWork := bw + ((d+1)^2*(2*d+u+8)+(bits d+1+u+3)^2+2)
z.1 = OCTKernel.Main.blockRank A.matrix F ∧
prep + z.2 ≤ prep + (d*(m*(n*t)*(testWork+1)+1+(m+2*m*(n*t)+2))+1) := by sorry
Source
Kumabe et al., STOC project #810, Definition 3.1 (block rank), with the integer Berkowitz implementation of project #814, Section 4. This is an auxiliary implementation result.