Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Corner ranks of a partial-swap frame

Proved
IntMul.OpenAI.partial_swap_corner_ranks

by xuanji · Oct 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

integer-multiplicationlinear-algebra

Let KKK be a field and ppp an m×mm\times mm×m idempotent matrix (p2=pp^2=pp2=p), and put q=1−pq=1-pq=1−p. The partial swap frame on paired fields (H,D)(H,D)(H,D) is the 2m×2m2m\times 2m2m×2m matrix

Sp=(qppq),S_p=\begin{pmatrix}q&p\\p&q\end{pmatrix},Sp​=(qp​pq​),

with rows and columns ordered H0,…,Hm−1,D0,…,Dm−1H_0,\dots,H_{m-1},D_0,\dots,D_{m-1}H0​,…,Hm−1​,D0​,…,Dm−1​. For X,Y∈NX,Y\in\mathbb NX,Y∈N write p[<X,≥Y]p[{<}X,{\ge}Y]p[<X,≥Y] for the block of rows <X<X<X and columns ≥Y\ge Y≥Y. The northeast corners of SpS_pSp​ have the following ranks:

  • (B) rows H<XH_{<X}H<X​, columns H≥Y∪DH_{\ge Y}\cup DH≥Y​∪D:  #[Y,X)+rank⁡p[<min⁡(X,Y), ⋅ ]\ \#[Y,X)+\operatorname{rank}p[{<}\min(X,Y),\,\cdot\,] #[Y,X)+rankp[<min(X,Y),⋅];
  • (C) rows H∪D<XH\cup D_{<X}H∪D<X​, columns D≥YD_{\ge Y}D≥Y​:  #[Y,X)+rank⁡p[ ⋅ ,≥max⁡(X,Y)]\ \#[Y,X)+\operatorname{rank}p[\,\cdot\,,{\ge}\max(X,Y)] #[Y,X)+rankp[⋅,≥max(X,Y)];
  • (D) rows H∪D<XH\cup D_{<X}H∪D<X​, columns H≥Y∪DH_{\ge Y}\cup DH≥Y​∪D:  #{c≥Y}+min⁡(X,m)+rank⁡p[<Y,≥X]\ \#\{c\ge Y\}+\min(X,m)+\operatorname{rank}p[{<}Y,{\ge}X] #{c≥Y}+min(X,m)+rankp[<Y,≥X].

The remaining corners (rows in HHH, columns in DDD) are blocks of ppp 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 SpS_pSp​ can be read off from the Bruhat pivots of ppp: it swaps Hi↔DjH_i\leftrightarrow D_jHi​↔Dj​ for every pivot (i,j)(i,j)(i,j) of ppp and fixes all other coordinates. This is the "runs" principle of Jain's flag-basis and partial-swap batching notes: a frame change SpS_pSp​ on an edge of the two-stage bit interchange costs exactly rank⁡p\operatorname{rank}prankp field transpositions, grouped into runs that follow the pivots of ppp.

Formalization Note The blocks are written with Matrix.of on sum and subtype index types; #[Y,X)\#[Y,X)#[Y,X) counts c∈c\inc∈ Fin m with Y≤c<XY\le c<XY≤c<X.

Preamble
import Mathlib
Formal statement
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
Source
S. Jain, integer-mult-kappa, notes/flag-basis.tex ('Runs') and notes/partial-swap-batching.tex, https://github.com/Swapnil-jain/integer-mult-kappa ; frames S_p from the two-stage bit motif (Paureel's fork of CrocSwap/integer-mult-bounds); OpenAI, Integer multiplication below n log n, Section 4

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me