Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Recursive Y/Z compatibility and exact histogram counts

Definition
mme_recursive_yz_compatibility

by raresbuhai · Sep 12, 2026 · Mathlib 777aaa6 (Lean v4.29.0-rc3)

asymmetric-hashingcombinatoricsmatrix-multiplication

For a finite set of positions partitioned into coarse cells, usefulness fixes the full fine-word histogram in every cell. Compatibility fixes each boundary cell separately and fixes only the aggregate histogram over cells with the same retained coarse-mode label. The associated partition has individual boundary cells and one merged interior cell per coarse-mode label.

For integer cell histograms μ\muμ, define the exact multinomial count ∏c(∑wμ(c,w))!/∏wμ(c,w)!\prod_c (\sum_w\mu(c,w))!/\prod_w\mu(c,w)!∏c​(∑w​μ(c,w))!/∏w​μ(c,w)!. Applying this formula to the boundary/interior partition defines the compatibility count. These are concrete finite counting predicates for the recursive Y and Z filters; no loss bound or tensor restriction is assumed in the definitions.

Definition code
import Mathlib.Data.Fintype.Pi
import Mathlib.Data.Nat.Choose.Multinomial

open BigOperators
set_option autoImplicit false

namespace MME.RecursiveYZ

/-- The number of occurrences of a full fine word in one coarse cell. -/
noncomputable def count {P C W : Type*} [Fintype P]
    (cell : P → C) (f : P → W) (c : C) (w : W) : ℕ := by
  classical
  exact (Finset.univ.filter (fun p ↦ cell p = c ∧ f p = w)).card

/-- Exact usefulness keeps the full joint cell histogram. -/
noncomputable def Useful {P C W : Type*} [Fintype P]
    (cell : P → C) (mu : C → W → ℕ) (f : P → W) : Prop :=
  ∀ c w, count cell f c w = mu c w

/-- Compatibility fixes individual boundary cells and aggregates all cells
sharing the retained coarse mode and parent component. -/
noncomputable def Compatible {P C W G : Type*} [Fintype P] [Fintype C]
    (cell : P → C) (boundary : C → Prop) (group : C → G)
    (mu : C → W → ℕ) (f : P → W) : Prop := by
  classical
  exact (∀ c, boundary c → ∀ w, count cell f c w = mu c w) ∧
    ∀ g w, count (group ∘ cell) f g w = ∑ c, if group c = g then mu c w else 0

/-- Partition into individual boundary cells and merged interior cells,
corresponding to Claim 6.19 and its Z analogue. -/
noncomputable def part {C G : Type*} (boundary : C → Prop) (group : C → G)
    (c : C) : {c : C // boundary c} ⊕ G := by
  classical
  exact if h : boundary c then Sum.inl ⟨c,h⟩ else Sum.inr (group c)

noncomputable def partCount {C W G : Type*} [Fintype C]
    (boundary : C → Prop) (group : C → G) (mu : C → W → ℕ)
    (s : {c : C // boundary c} ⊕ G) (w : W) : ℕ := by
  classical
  exact match s with
    | Sum.inl c => mu c w
    | Sum.inr g => ∑ c, if ¬ boundary c ∧ group c = g then mu c w else 0

/-- Exact multinomial count for words with a specified histogram in each cell. -/
noncomputable def histogramNumber {C W : Type*} [Fintype C] [Fintype W]
    (mu : C → W → ℕ) : ℕ :=
  ∏ c, (∑ w, mu c w).factorial / ∏ w, (mu c w).factorial

/-- The exact compatibility count after partitioning boundary and interior cells. -/
noncomputable def compatibilityNumber {C W G : Type*}
    [Fintype C] [Fintype W] [Fintype G]
    (boundary : C → Prop) (group : C → G) (mu : C → W → ℕ) : ℕ := by
  classical
  exact histogramNumber (partCount boundary group mu)

end MME.RecursiveYZ
Source
Alman et al., More Asymmetry Yields Faster Matrix Multiplication, arXiv:2404.16349v2, Definitions 6.8, 6.10, 6.11 and Claims 6.18--6.20; https://arxiv.org/html/2404.16349v2#S6.SS3. These are exact finite-count formalizations; the paper writes normalized profiles and asymptotic entropy bounds.

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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me