Structured proof · Unit 147
lemma Data.gridParam_interlace What it says For P , data D , an infinite place \tau and an integer x : at the node (m, m ), the number of entries of - gridParam(true, 0, m, m, \tau ) above x minus the number of entries of gridParam(false, 0, m, m, \tau ) above x lies in \{0, 1\} : the negated parameter of the grid Z and the parameter of the grid V interlace.
The argument in brief Count entries above x block by block with closed forms g(n, \cdot) for arithmetic progressions; the difference is the contribution of one base entry, between 0 and 1; induction on m .
9 steps, 7 of them leaves · New/Exchange/GridParameters.lean, lines 128–140 · in the notes: Definition 3.1, p. 6 of The grid of lifts and descents, and the crude rows
Expand all Collapse all ↑ ↓ or j k: step · ← →: fold · Enter: show its lines
Let \varphi(y) = [x < y] and g(n, y) = \max(0, \min(n , (y - x)/2 )).
For every A and n : \sum_{i<n} \varphi(A - 2i) = g(n, A + 1) and \sum_{i<n} \varphi(-1 -(A - 2i)) = g(n, 2n - A - 2) (C , by induction on n ).
Lean states ∑ i ∈ range n, φ (A - 2 * i) = g n (A + 1) ∧ ∑ i ∈ range n, φ (-1 + -(A - 2 * i)) =
g n (2 * n - A - 2)
Uses step 1
It suffices that the difference lies in [\varphi(s), \varphi(-1 - s) ] for s = 2\varsigma(\tau, r) (a set inclusion, by arithmetic).
Uses step 1
Write the two counts as sums of \varphi .
The goal is the difference of the two sums of \varphi .
Lean states ∑ _, φ _ - ∑ _, φ _ ∈ _
Expand the sums over the blocks of the index sets (gridParam, the products of index types, the sums over ranges), using C .
Uses step 2
With r = k - 1 + m , induction on m (only the base case is a written branch).
Base case m = 0 : unfold rowParameter and conclude by arithmetic.
Inductive step: by arithmetic (grind).
New/Exchange/GridParameters.lean · lines 128–140 lemma gridParam_interlace x : (#{j | x < -D.gridParam true 0 D.m D.m τ j} - #{i | x < D.gridParam false 0 D.m D.m τ i} : ℤ) ∈ Icc 0 1 := by let φ y : ℤ := ite (x < y) 1 0; let g n y := max 0 (min n ((y - x) / 2)) have C A n : ∑ i ∈ range n, φ (A - 2 * i) = g n (A + 1) ∧ ∑ i ∈ range n, φ (-1 + -(A - 2 * i)) = g n (2 * n - A - 2) := by induction n <;> grind -funext apply (by grind : ∀ s, Icc (φ s) (φ (-1 + -s)) ⊆ _) (2 * D.rowParameter τ D.r) push_cast [card_filter]; show ∑ _, φ _ - ∑ _, φ _ ∈ _ simp [reindex_equiv D.gridBlockEquiv.symm, gridParam, sum_prod_type, sum_fin_eq_sum_range, ↓← mem_range, sum_range_succ, -neg_sub, ← two_mul, C] rw [(by grind : D.r = D.k - 1 + D.m)]; induction D.m · simp +contextual [rowParameter, ↓← Nat.lt_sub_iff_add_lt, ← mem_range, mul_sub, -neg_sub, C]; grind grind -ring -funext (splits := 40) Lines of the statement are marked in the margin. The declaration in its file .