Corner ranks of a partial-swap frame
ProvedIntMul.OpenAI.partial_swap_corner_ranksLet be a field and an idempotent matrix (), and put . The partial swap frame on paired fields is the matrix
with rows and columns ordered . For write for the block of rows and columns . The northeast corners of have the following ranks:
- (B) rows , columns : ;
- (C) rows , columns : ;
- (D) rows , columns : .
The remaining corners (rows in , columns in ) are blocks of itself. Combined with IntMul.OpenAI.bruhat_rank_profile and IntMul.OpenAI.partial_perm_eq_of_corner_counts, these formulas show that the lower–lower Bruhat involution of can be read off from the Bruhat pivots of : it swaps for every pivot of and fixes all other coordinates. This is the "runs" principle of Jain's flag-basis and partial-swap batching notes: a frame change on an edge of the two-stage bit interchange costs exactly field transpositions, grouped into runs that follow the pivots of .
Formalization Note The blocks are written with Matrix.of on sum and subtype index types; counts Fin m with .
import Mathlib
namespace IntMul.OpenAI
theorem partial_swap_corner_ranks {m : ℕ} {K : Type*} [Field K] (p : Matrix (Fin m) (Fin m) K) (hp : p * p = p)
(X Y : ℕ) :
-- (B) rows H_{<X}, columns H_{≥Y} ⊕ D
(Matrix.of fun (r : {r : Fin m // r.val < X}) (c : {c : Fin m // Y ≤ c.val} ⊕ Fin m) =>
Sum.elim (fun c => (1 - p) r.1 c.1) (fun c => p r.1 c) c).rank =
(Finset.univ.filter fun c : Fin m => Y ≤ c.val ∧ c.val < X).card +
(p.submatrix (fun r : {r : Fin m // r.val < min X Y} => r.1) id).rank ∧
-- (C) rows H ⊕ D_{<X}, columns D_{≥Y}
(Matrix.of fun (r : Fin m ⊕ {r : Fin m // r.val < X}) (c : {c : Fin m // Y ≤ c.val}) =>
Sum.elim (fun r => p r c.1) (fun r => (1 - p) r.1 c.1) r).rank =
(Finset.univ.filter fun c : Fin m => Y ≤ c.val ∧ c.val < X).card +
(p.submatrix id (fun c : {c : Fin m // max X Y ≤ c.val} => c.1)).rank ∧
-- (D) rows H ⊕ D_{<X}, columns H_{≥Y} ⊕ D
(Matrix.of fun (r : Fin m ⊕ {r : Fin m // r.val < X}) (c : {c : Fin m // Y ≤ c.val} ⊕ Fin m) =>
Sum.elim (fun r => Sum.elim (fun c => (1 - p) r c.1) (fun c => p r c) c)
(fun r => Sum.elim (fun c => p r.1 c.1) (fun c => (1 - p) r.1 c) c) r).rank =
(Finset.univ.filter fun c : Fin m => Y ≤ c.val).card + min X m +
(p.submatrix (fun r : {r : Fin m // r.val < Y} => r.1) (fun c : {c : Fin m // X ≤ c.val} => c.1)).rank := by sorry
end IntMul.OpenAI