Skip to content

Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.

Python

Merge main and reuse the split Gram matrix-vector lemma

Aviad Rozenhekdbc129a5c29d
diff --cc src/Lib/DiscreteSeries/Bruhat/FloorGroups.lean
index 135ffe719b5,ee9e70eeb44..e78a3dfb6d3
--- a/src/Lib/DiscreteSeries/Bruhat/FloorGroups.lean
+++ b/src/Lib/DiscreteSeries/Bruhat/FloorGroups.lean
@@@ -235,28 -235,6 +235,40 @@@ lemma mem_floorGroup
g.val i j = (1 : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) i j :=
Iff.rfl
+/-- Two rows have the same dot product with a column if they agree wherever it is nonzero. -/
+private lemma dotProduct_eq_on_support {ι : Type*} [Fintype ι] {R : Type*} [Semiring R]
+ {u v w : ι → R} (h : ∀ k, w k ≠ 0 → u k = v k) : u ⬝ᵥ w = v ⬝ᵥ w := by
+ apply Finset.sum_congr rfl
+ intro k _
+ by_cases hk : w k = 0 <;> simp [hk, h]
+
++omit [StarRing A] in
++/-- At an index of a hyperbolic pair, the coordinate of `J e`, where `J = T.splitGram`, is the
++coordinate of `e` at the other index of the pair. -/
++lemma splitGram_mulVec_apply (i : 𝔰.BesselIndex) (hi : floorOf i < 𝔰.ϱ) :
++ (T.splitGram *ᵥ e) i = e (oppositeIndex i) := by
++ revert i
++ simp only [splitGram, fromBlocks_mulVec, zero_mulVec, fromCols_mulVec, one_mulVec,
++ zero_add, fromRows_mulVec, add_zero, Sum.forall, floorOf, Fin.is_lt, elim_inl,
++ Function.comp_apply, oppositeIndex, imp_self, implies_true, elim_inr, Pi.add_apply,
++ Pi.zero_apply, add_lt_iff_neg_left, not_lt_zero, IsEmpty.forall_iff,
++ lt_self_iff_false, and_self]
++
+/-- Read row `i` of `J g = (g⁻¹)ᴴ J`. On a hyperbolic pair the left side picks out the opposite
+row of `g`. On the right, only the nonzero entries of the Gram column contribute. -/
+private lemma row_eq_one_of_inv_col (i k : 𝔰.BesselIndex) (hi : floorOf i < 𝔰.ϱ)
+ (h : ∀ x, T.splitGram x k ≠ 0 → g⁻¹.val x i = (1 : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) x i) :
+ g.val (oppositeIndex i) k = (1 : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) (oppositeIndex i) k := by
+ have row (M : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) :
- (T.splitGram * M) i k = M (oppositeIndex i) k := by
- simp [Matrix.mul_apply, splitGram_eq_ite_oppositeIndex _ _ (.inl hi), ite_mul]
++ (T.splitGram * M) i k = M (oppositeIndex i) k :=
++ splitGram_mulVec_apply (e := M.col k) i hi
+ have h_form : T.splitGram * g.val.val = g⁻¹.val.valᴴ * T.splitGram := by
+ simpa only [InvMemClass.coe_inv, coe_units_inv, inv_inv] using U.form_mul_inv_eq g⁻¹
+ rw [← row g.val.val, h_form]
+ trans ((1 : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A)ᴴ * T.splitGram) i k
+ · exact dotProduct_eq_on_support fun x hx ↦ congrArg star (h x hx)
+ · simpa using row 1
+
/-- An element of `H_l = floorGroup l` agrees with `1` in the rows of floor below `l` that belong to
a hyperbolic pair. -/
lemma floorGroup_apply_row (hg : g ∈ floorGroup l) (i j : 𝔰.BesselIndex) (hi : floorOf i < l)
@@@ -564,16 -547,22 +576,11 @@@ lemma splitGram_col (i : 𝔰.BesselInd
implies_true, add_lt_iff_neg_left, not_lt_zero, or_true, inr.injEq, lt_self_iff_false,
and_self, inl.injEq, IsEmpty.forall_iff, and_true, true_and]
--/-- At an index of a hyperbolic pair, the coordinate of `J e`, where `J = T.splitGram`, is the
--coordinate of `e` at the other index of the pair. -/
--lemma splitGram_mulVec_apply (i : 𝔰.BesselIndex) (hi : floorOf i < 𝔰.ϱ) :
-- (T.splitGram *ᵥ e) i = e (oppositeIndex i) := by
-- revert i
-- simp only [splitGram, fromBlocks_mulVec, zero_mulVec, fromCols_mulVec, one_mulVec,
-- zero_add, fromRows_mulVec, add_zero, Sum.forall, floorOf, Fin.is_lt, elim_inl,
-- Function.comp_apply, oppositeIndex, imp_self, implies_true, elim_inr, Pi.add_apply,
-- Pi.zero_apply, add_lt_iff_neg_left, not_lt_zero, IsEmpty.forall_iff,
-- lt_self_iff_false, and_self]
-
+ omit [StarRing A] in
+ /-- Multiplying by the split Gram matrix reads the opposite row at a hyperbolic basis index. -/
+ lemma splitGram_mul_apply_inl (M : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) (a : Fin 𝔰.ϱ)
+ (j : 𝔰.BesselIndex) : (T.splitGram * M) (inl a) j = M (eStar a) j :=
+ splitGram_mulVec_apply (e := M.col j) (inl a) a.is_lt
/-- At an index of a hyperbolic pair, the coordinate of `e J`, where `J = T.splitGram`, is the
coordinate of `e` at the other index of the pair. -/