While this submission is a draft, it cannot be used by other submissions.

Hinted Boolean matrix-vector problems

Lax350013.HintedMatrixVector · concepts/Lax350013/HintedMatrixVector.lean · lax-350013

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The v-hinted Mv, Mv-hinted Mv and uMv-hinted uMv problems reveal their inputs in successive phases. This specification includes the Boolean products, phase layouts and the conjectured trade-offs. Rectangular matrix-multiplication exponents are numerical parameters here; their values and lower bounds are not asserted.

    Concept map
    5 concepts; 1 descendant hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1/-
    2Copyright (c) 2026 Anthropic, PBC. All rights reserved.
    3Released under Apache 2.0 license as described in the file LICENSE.
    4SPDX-License-Identifier: Apache-2.0
    5-/
    6/-
    7Modified for the independent Lax packaging by Édouard Bonnet, 2026.
    8Derived from 3sum-apsp/EndStatement.lean / PaperStatements.lean at upstream commit e1a4e6508154ea59f030480661590a9fe3018011.
    9Changes: Lax module/namespace layout, separated concepts and proofs, archive
    10annotations, and compatibility with the archive Lean/mathlib environment.
    11See NOTICE and README.md in the submission root for provenance and scope.
    12-/
    13
    14import Mathlib.Algebra.MvPolynomial.Basic
    15import Mathlib.Analysis.SpecialFunctions.Log.Base
    16import Mathlib.Analysis.SpecialFunctions.Log.Basic
    17import Mathlib.Analysis.SpecialFunctions.Pow.Real
    18import Mathlib.Combinatorics.SimpleGraph.Basic
    19import Mathlib.Data.Finset.Sort
    20import Mathlib.LinearAlgebra.Matrix.Notation
    21import Mathlib.MeasureTheory.Integral.Bochner.Basic
    22import Mathlib.NumberTheory.PrimeCounting
    23import Mathlib.Probability.Independence.Basic
    24import Mathlib.Tactic.DeriveFintype
    25import Lax350013.ThinMatrices
    26
    27/-!
    28---
    29title: Hinted Boolean matrix-vector problems
    30type: definition
    31---
    32The v-hinted Mv, Mv-hinted Mv and uMv-hinted uMv problems reveal their inputs in successive phases. This specification includes the Boolean products, phase layouts and the conjectured trade-offs. Rectangular matrix-multiplication exponents are numerical parameters here; their values and lower bounds are not asserted.
    33-/
    34
    35namespace Lax350013.HintedMatrixVector
    36
    37open Finset
    38open Lax350013.WordRAM
    39open Lax350013.RAMResources
    40open Lax350013.ThinMatrices
    41
    42namespace HintedMv
    43
    44/-- Section 5.4: "All three are over the Boolean semiring". The product of two Boolean matrices. -/
    45def boolMul {l m r : ℕ} (M : Matrix (Fin l) (Fin m) Bool) (V : Matrix (Fin m) (Fin r) Bool) :
    46 Matrix (Fin l) (Fin r) Bool :=
    47 fun i j => decide (∃ k, M i k = true ∧ V k j = true)
    48
    49/-- Proof of Corollary 40: "We compute over ℤ with 0/1 matrices". The 0/1 integer matrix
    50of a Boolean matrix. -/
    51def toInt {l m : ℕ} (M : Matrix (Fin l) (Fin m) Bool) : Matrix (Fin l) (Fin m) ℤ :=
    52 fun i j => if M i j = true then 1 else 0
    53
    54/-- Section 5.4, v-hinted Mv (Definition 5.1 of [vdBNS19]): "Phase 1: an n × t matrix M. Phase 2: a
    55t × n matrix V. Phase 3: an index i, after which the algorithm outputs MV_{[n],i}, the product of M
    56and column i of V." -/
    57def vHintedOutput {n t : ℕ} (M : Matrix (Fin n) (Fin t) Bool) (V : Matrix (Fin t) (Fin n) Bool)
    58 (i : Fin n) : Fin n → Bool :=
    59 fun r => boolMul M V r i
    60
    61/-- Section 5.4, Mv-hinted Mv (Definition 5.6 of [vdBNS19]): "Phase 1: N ∈ {0,1}^{n×n} and V ∈
    62{0,1}^{t×n}. Phase 2: a vector I ∈ [n]^t of column indices. Phase 3: an index j, after which the
    63algorithm outputs N_{[n],I} V_{[t],j}, where N_{[n],I} is the n × t matrix whose k-th column is
    64column I_k of N." -/
    65def MvHintedOutput {n t : ℕ} (N : Matrix (Fin n) (Fin n) Bool) (V : Matrix (Fin t) (Fin n) Bool)
    66 (I : Fin t → Fin n) (j : Fin n) : Fin n → Bool :=
    67 fun r => boolMul (N.submatrix id I) V r j
    68
    69/-- Section 5.4, uMv-hinted uMv (Definition 5.11 of [vdBNS19]): "Phase 1: U ∈ {0,1}^{n×t₁}, N ∈
    70{0,1}^{n×n}, and V ∈ {0,1}^{t₂×n}. Phase 2: I ∈ [n]^{t₁}. Phase 3: J ∈ [n]^{t₂}. Phase 4: indices
    71i and j, after which the algorithm outputs (U N_{I,J} V)_{i,j}, where N_{I,J} is the t₁ × t₂
    72submatrix of N with the rows I and the columns J." -/
    73def uMvHintedOutput {n t₁ t₂ : ℕ} (U : Matrix (Fin n) (Fin t₁) Bool)
    74 (N : Matrix (Fin n) (Fin n) Bool) (V : Matrix (Fin t₂) (Fin n) Bool) (I : Fin t₁ → Fin n)
    75 (J : Fin t₂ → Fin n) (i j : Fin n) : Bool :=
    76 boolMul (boolMul U (N.submatrix I J)) V i j
    77
    78/-- Section 5.4: "Each conjecture asserts that no algorithm simultaneously beats all of its listed
    79bounds, for any ε > 0." v-hinted Mv (Conjecture 5.2 of [vdBNS19]): "Bounds conjectured to be
    80impossible to achieve simultaneously: n^{ω(1,1,τ)-ε} for Phase 2 and n^{1+τ-ε} for Phase 3."
    81
    82Running times are not defined here, so the conjecture is stated relative to a parameter:
    83`Achieves a₂ a₃` stands for "some algorithm solves the problem with t = n^τ, with polynomial time in
    84Phase 1, O(n^{a₂}) time in Phase 2 and O(n^{a₃}) time in Phase 3". `ω` stands for the number
    85ω(1,1,τ). For programs of the word RAM the parameter is `AchievesVHinted τ`. The exponents of
    86rectangular matrix multiplication are not defined in Lean: `ω` is an arbitrary real number here, and
    87the definition says something only together with a condition on it. The statement that the
    88conjecture fails (`Items.Corollary_40_fail`) is made for every `ω ≥ 2`.
    89
    90[vdBNS19] words the bounds as lower bounds Ω(n^{x-ε}) on the time of a phase. That wording implies
    91the one used here, "not O(n^{x-ε})" (apply it with ε/2), so a refutation of the conjecture in this
    92form refutes it as worded there. The same holds for `Conjecture57` and `Conjecture512`. -/
    93def Conjecture52 (Achieves : ℝ → ℝ → Prop) (ω τ : ℝ) : Prop :=
    94 ∀ ε > 0, ¬ Achieves (ω - ε) (1 + τ - ε)
    95
    96/-- Section 5.4, Mv-hinted Mv (Conjecture 5.7 of [vdBNS19]): "n^{ω(1,τ,1)-ε} for Phase 2 and
    97n^{1+τ-ε} for Phase 3." `Achieves` is as in `Conjecture52`, for the Mv-hinted Mv problem
    98(`AchievesMvHinted τ`); `ω` stands for ω(1,τ,1). -/
    99def Conjecture57 (Achieves : ℝ → ℝ → Prop) (ω τ : ℝ) : Prop :=
    100 ∀ ε > 0, ¬ Achieves (ω - ε) (1 + τ - ε)
    101
    102/-- Section 5.4, uMv-hinted uMv (Conjecture 5.12 of [vdBNS19]): "n^{ω(1,τ₁,1)-ε} for Phase 2,
    103n^{ω(τ₂,τ₁,1)-ε} for Phase 3, and n^{τ₁+τ₂-ε} for Phase 4." `Achieves a₂ a₃ a₄` stands for "some
    104algorithm solves the problem with t₁ = n^{τ₁} and t₂ = n^{τ₂}, with polynomial time in Phase 1 and
    105O(n^{a₂}), O(n^{a₃}), O(n^{a₄}) time in Phases 2, 3, 4"; `ω₂` stands for ω(1,τ₁,1) and `ω₃` for
    106ω(τ₂,τ₁,1). For programs of the word RAM the parameter is `AchievesUMvHinted τ₁ τ₂`. -/
    107def Conjecture512 (Achieves : ℝ → ℝ → ℝ → Prop) (ω₂ ω₃ τ₁ τ₂ : ℝ) : Prop :=
    108 ∀ ε > 0, ¬ Achieves (ω₂ - ε) (ω₃ - ε) (τ₁ + τ₂ - ε)
    109
    110end HintedMv
    111
    112open HintedMv
    113
    114/-- Section 5.4: the hint dimension "t = n^τ".
    115
    116NOTE. The paper treats `n^τ` as an integer; here it is rounded down, which keeps what the proof of
    117Corollary 40 needs, for `n ≥ 1`: `t ≥ 1` if `τ ≥ 0`, and `t^18 ≤ n` if `0 ≤ τ ≤ 1/18`. The number
    118`t` is given to the programs in Phase 1, after `n`; they need not compute it. -/
    119noncomputable def hintSize (τ : ℝ) (n : ℕ) : ℕ := ⌊(n : ℝ) ^ τ⌋₊
    120
    121/-- **v-hinted Mv** (Section 5.4; Definition 5.1 of [vdBNS19]) with `t = n^τ` is solved with
    122polynomial time in Phase 1, `O(n^{a₂})` time in Phase 2 and `O(n^{a₃})` time in Phase 3. Phase 1
    123receives `n`, `t` and the `n × t` matrix `M`; Phase 2 the `t × n` matrix `V`; Phase 3 the index `i`;
    124the output is the `n` entries of the Boolean product of `M` and column `i` of `V`. -/
    125def AchievesVHinted (τ a₂ a₃ : ℝ) : Prop :=
    126 ∃ (P₁ P₂ P₃ : List Instr) (b : ℕ) (C a₁ : ℝ), ∀ n : ℕ, 1 ≤ n →
    127 ∀ (M : Matrix (Fin n) (Fin (hintSize τ n)) Bool) (V : Matrix (Fin (hintSize τ n)) (Fin n) Bool)
    128 (i : Fin n) (bits : ℕ), Admissible b [n] bits →
    129 ∃ s₁ s₂ s₃ : ℕ, Within s₁ C n a₁ ∧ Within s₂ C n a₂ ∧ Within s₃ C n a₃ ∧
    130 RunsPhases (fun c off => ∀ r : Fin n, output c off r.val = bit (vHintedOutput M V i r))
    131 (loadWords bits []) 0
    132 [(P₁, [(n : ℤ), (hintSize τ n : ℤ)] ++ rowMajor (toInt M), s₁),
    133 (P₂, rowMajor (toInt V), s₂), (P₃, [(i.val : ℤ)], s₃)]
    134
    135/-- **Mv-hinted Mv** (Section 5.4; Definition 5.6 of [vdBNS19]) with `t = n^τ`, in the same sense.
    136Phase 1 receives `n`, `t`, the `n × n` matrix `N` and the `t × n` matrix `V`; Phase 2 the `t` column
    137indices `I`; Phase 3 the index `j`; the output is the `n` entries of `N_{[n],I} V_{[t],j}`. -/
    138def AchievesMvHinted (τ a₂ a₃ : ℝ) : Prop :=
    139 ∃ (P₁ P₂ P₃ : List Instr) (b : ℕ) (C a₁ : ℝ), ∀ n : ℕ, 1 ≤ n →
    140 ∀ (N : Matrix (Fin n) (Fin n) Bool) (V : Matrix (Fin (hintSize τ n)) (Fin n) Bool)
    141 (I : Fin (hintSize τ n) → Fin n) (j : Fin n) (bits : ℕ), Admissible b [n] bits →
    142 ∃ s₁ s₂ s₃ : ℕ, Within s₁ C n a₁ ∧ Within s₂ C n a₂ ∧ Within s₃ C n a₃ ∧
    143 RunsPhases (fun c off => ∀ r : Fin n, output c off r.val = bit (MvHintedOutput N V I j r))
    144 (loadWords bits []) 0
    145 [(P₁, [(n : ℤ), (hintSize τ n : ℤ)] ++ rowMajor (toInt N) ++ rowMajor (toInt V), s₁),
    146 (P₂, List.ofFn fun k => ((I k).val : ℤ), s₂), (P₃, [(j.val : ℤ)], s₃)]
    147
    148/-- **uMv-hinted uMv** (Section 5.4; Definition 5.11 of [vdBNS19]) with `t₁ = n^{τ₁}` and `t₂ =
    149n^{τ₂}` is solved with polynomial time in Phase 1 and `O(n^{a₂})`, `O(n^{a₃})`, `O(n^{a₄})` time in
    150Phases 2, 3, 4. Phase 1 receives `n`, `t₁`, `t₂` and the matrices `U` (`n × t₁`), `N` (`n × n`),
    151`V` (`t₂ × n`); Phase 2 the `t₁` row indices `I`; Phase 3 the `t₂` column indices `J`; Phase 4 the
    152indices `i` and `j`; the output is the one entry `(U N_{I,J} V)_{i,j}`. -/
    153def AchievesUMvHinted (τ₁ τ₂ a₂ a₃ a₄ : ℝ) : Prop :=
    154 ∃ (P₁ P₂ P₃ P₄ : List Instr) (b : ℕ) (C a₁ : ℝ), ∀ n : ℕ, 1 ≤ n →
    155 ∀ (U : Matrix (Fin n) (Fin (hintSize τ₁ n)) Bool) (N : Matrix (Fin n) (Fin n) Bool)
    156 (V : Matrix (Fin (hintSize τ₂ n)) (Fin n) Bool) (I : Fin (hintSize τ₁ n) → Fin n)
    157 (J : Fin (hintSize τ₂ n) → Fin n)
    158 (i j : Fin n) (bits : ℕ), Admissible b [n] bits →
    159 ∃ s₁ s₂ s₃ s₄ : ℕ, Within s₁ C n a₁ ∧ Within s₂ C n a₂ ∧ Within s₃ C n a₃ ∧ Within s₄ C n a₄ ∧
    160 RunsPhases (fun c off => output c off 0 = bit (uMvHintedOutput U N V I J i j))
    161 (loadWords bits []) 0
    162 [(P₁, [(n : ℤ), (hintSize τ₁ n : ℤ), (hintSize τ₂ n : ℤ)] ++ rowMajor (toInt U) ++
    163 rowMajor (toInt N) ++ rowMajor (toInt V), s₁),
    164 (P₂, List.ofFn fun k => ((I k).val : ℤ), s₂),
    165 (P₃, List.ofFn fun k => ((J k).val : ℤ), s₃),
    166 (P₄, [(i.val : ℤ), (j.val : ℤ)], s₄)]
    167
    168end Lax350013.HintedMatrixVector
    169

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…