Skip to content

Chain Determinant Factorization and Two-Grid Auxiliary Forms ​

This page explains the two combinatorial engines built directly on top of OneSquare.lean: src/New/Determinant/Chain/NormOfChain.lean (05_determinant/norm_of_chain, 24 declarations, 1 let-type stub truncation documented verbatim below) and src/New/Determinant/AuxiliaryForms/SpanningForms.lean (05_determinant/spanning_forms, 29 declarations, 0 stub truncations), backed by ChainNorms.lean, GridPaths.lean, and DiagonalTurns.lean. Return to the Stage 05 Overview, or revisit Siegel–Weil Exchange and the Commuting Theta Square and continue to Regular Twist Families and the Assembly of Theorem C.

Level 1 · First-Principles

Level 1 — First-Principles ​

With the commuting theta squaretheta square law in hand, Stage 05 uses it twice—in two completely different geometric configurations—to supply the two halves of Theorem C's input on the indefinite target space Y0:

Side-by-side geometric diagram comparing the triangular lift array in NormOfChain on the left against the two square grids meeting along the diagonal in SpanningForms on the right

Left panel: Sliding lifts across a triangular array (NormOfChain.lean) ​

On the target space D.targetForms (good forms on Y0), the m-step chain map D.Θ ϑ (called ιϑ in upstream comments) lifts target forms along Y0→Y1→⋯→Ym for an m-fold twistregular twist family ϑ. Measuring how much D.Θ ϑ stretches volumes requires its squared Gram determinantGram determinant Z(ϑ)=det(Θϑ∗Θϑ) (D.chainDeterminant ϑ; note that upstream docstrings call u.normDet ^ 2 = det(u^* u) the "volume" of u, while Lean names it "determinant").

Why can we not compute Z(ϑ) in one step? Because after the very first lift, the chain exits the convergent range of the Rallis inner product formulaRallis inner product formula. Instead, ChainNorms.lean and NormOfChain.lean embed the chain inside a triangle of lifts indexed by intervals (i,n):

  1. Slide lifts past descents: Applying the theta square law across every square in the triangle pushes all descents past all lifts until Θϑ∗Θϑ collapses onto a scalar multiple of the Rallis product Rϑ=R1⋯Rm of m first-step spherical Hecke operatorsHecke operator on Y0:Θϑ∗Θϑ=c(ϑ)cQmRϑ(exists_adjoint_chain_comp_eq_smul_rallisProduct).Watch a crucial honesty point here: the intermediate predicate HasAbsUpToNormPower allows the constant C in ∥c(ϑ)∥2=C⋅Nm(Q)k(∏quotientRatio)2 to be 0. Strict positivity (C>0, liftDeterminant_pos, and chainDeterminant_pos) is not forced by the square law; it is proved separately from the injectivity of the lifts (lowerChainAtLevel_injective) in the convergent Rallis range.
  2. Transfer determinants from Y0 to Wj: For each 1≤j≤m, the single lift D.goodLift ϑ j maps good forms on the definite companion space Wj to Vj (note the argument convention: goodLift ϑ j takes a single TameChar, whereas liftDeterminant ϑ j takes an MFoldTwist and evaluates the j-th lift at ϑj). Borrowing Stage 04's trace comparison across signaturestrace comparison (det_rallisOnGood_eq) replaces det(Rj|Wj) by det(Rj|Y0) (exists_normDet_goodLift_sq_eq).
  3. Exact factorization and height of the quotient scalar: Taking determinants and dividing by ϑ=1 cancels all unknown base constants C and cQ, yielding exists_chainDeterminant_pos_and_div_chainDeterminant_one_eq:Z(ϑ)Z(1)=(Nm(Q)e/2∏1≤i<j≤mquotientRatioi,j(ϑ))d∏j=1mZj(ϑj)Zj(1).Under small ratios, each of the (m2)≤m2 quotient ratiosHecke L-value ratio contributes t inverse critical ratios of heightarithmetic height at most x1, so the inverse scalar has height at most m2tx1 (HasSmallRatios.heightLe_inv_rpow_mul_prod_quotientRatio), which LongForms.lean upgrades via D.le_of_hasLogBound to ≤b.

Finally, NormOfChain.lean proves D.range_goodLift_le: the range of D.goodLift ϑ j is spanned by lifts of good Hecke eigenforms landing inside a good polynomial-label idempotent—an interface exported directly to Stages 06 and 07 (06_one_lift/gluing_maps, 06_one_lift/lift_volume_height, 07_congruences/fit_twists_exist).

Right panel: Two square grids, m2 turns, and basis-completion lifts (SpanningForms.lean) ​

Theorem C also needs a full spanning family of auxiliary spanning formsauxiliary spanning form on Y0 whose m-step lifts stay integral at every primeprime number p∤Nm(Q) (after one shared twist scalar) and stay bounded in archimedean norm at the trivial twist. Because Y0 is indefinite, Stage 05 cannot construct those forms directly on Y0.

Instead, GridPaths.lean, DiagonalTurns.lean, and SpanningForms.lean lay down two square grids of Hermitian spaces, Yba and Y~ab (0≤a,b≤m), meeting along the shared diagonal (l,l), and trace monotone two-grid paths from Ym to the deep-level definite corner Y~0m:

  • First path: runs down the actual lower chain Y0→Ym paired against a surjective restriction map r from deep-level forms φ on Y~0m onto principal-level forms on Y0.
  • m2 turns across the grids: Step by step, the path sweeps across m2 squares—off-diagonal turns via the theta square law and diagonal turns via seesaw moves on the shared space Yjj+1=Y~jj+1seesaw duality—transferring the first-path period into a last-path period Ξ divided by a scalar c(ϑ) controlled by m2 turn ratios (exists_integral_lowerChainUpTo_eq_lastPathPeriod).
  • Reading values with delta forms: Along the last path, every space is definite and explicit: clearing kernel denominators (D.liftDenominator) and the middle branching pairing yields p-integrality up to exp⁡(x99b2) (exists_mul_lastPathPeriod_mem_embValRing) and archimedean growth at most exp⁡(x200b2) (norm_lastPathPeriod_le). Testing the first path against a dual-weight delta form δx(v) supported on a single finite class x uses Schur orthogonality (integral_lastPathConjDelta_mul) to read off the exact value of Θϑ(rφ) at x (exists_dualPairing_eq_mul_lastPathPeriod).
  • Lifting short deep-level forms: By Stage 03's short-form machinery (span_isShort_eq_top_gridLevelForms), deep-level forms on Y~0m are spanned by forms with p-adic gauge ≤1Weyl gauge and squared norm ≤exp⁡(x99b2). Pushing them through r yields New.Data.exists_span_short_lifts_eq_top: principal-level forms on Y0 are spanned by forms whose scaled lifts (c(ϑ)/c(1))lowerChainAtLevel ϑ y are p-integral for all p∤Nm(Q) and whose untwisted lifts have squared Weyl norm at most exp⁡(x202b2).

Where this analogy breaks ​

Comparing the triangle of lifts in NormOfChain and the two square grids in SpanningForms as "two applications of the same square commutation rule" captures their shared dependency on OneSquare.lean, but misses an important structural contrast. In NormOfChain, the diagonal is the base of the triangle where the single-step Rallis formula already converges—so sliding moves stop at m explicit Hecke operators whose determinants transfer to Wj via trace comparison. In SpanningForms, crossing the diagonal (l,l) between Yba and Y~ab is not an OneSquare move at all: it requires an extra seesaw on the common space S=Yjj+1=Y~jj+1 (DiagonalTurns.lean) that reverses a line kernel and swaps the two grids before reaching the definite corner Y~0m.

Level 2 · Undergrad Bridge

Level 2 — Undergrad Bridge ​

1. Chain determinant factorization (NormOfChain.lean, 24 decls, 1 truncation) ​

  1. Definitions and positivity (normDet_sq_eq_pow_mul_det, liftDeterminant, normDet_goodLift_sq_pos, liftDeterminant_pos, Θ, chainDeterminant, chainDeterminant_pos):
    • D.liftDeterminant ϑ j := ((D.goodLift (ϑ.pow j) j).normDet : ℂ) ^ 2 (using ϑj);
    • D.Θ ϑ restricts D.lowerChainAtLevel ϑ to D.targetForms, and D.chainDeterminant ϑ := ((D.Θ ϑ).normDet : ℂ) ^ 2;
    • Injectivity of single lifts and of lowerChainAtLevel (ChainNorms.lean) yields liftDeterminant_pos and chainDeterminant_pos.
  2. Single-lift determinant transfer (exists_normDet_goodLift_sq_eq): Combines the single-lift Rallis inner product on Wj with normDet_sq_eq_pow_mul_det, targetDim_eq_finrank_goodForms_spaceW, and Stage 04's det_rallisOnGood_eq to express ((D.goodLift ϑ j).normDet)^2 directly as (A⋅cQ)d⋅(D.rallisOnGood Y0 ϑ j).det for A≠0 independent of ϑ.
  3. Triangle Gram form and scalar positivity (rallisProduct, exists_inner_weightedChain_eq, exists_inner_chain_eq, isRamifiedRatio_of_mem_sigma, card_sigma_Ioc_le, prod_quotientRatio_one, prod_quotientRatio_nonneg, HasAbsUpToNormPower.exists_norm_div_eq_mul_prod_quotientRatio, exists_adjoint_chain_comp_eq_smul_rallisProduct):exists_inner_weightedChain_eq evaluates the Gram form of the weighted triangle chain against D.rallisProduct ϑ, and rescaling to D.Θ ϑ gives exists_inner_chain_eq with a scalar c(ϑ) obeying HasAbsUpToNormPower (which permits C=0). Evaluating at ϑ=1 where chainDeterminant_pos guarantees c(1)≠0 upgrades this to a strictly positive C>0 in exists_adjoint_chain_comp_eq_smul_rallisProduct.
  4. Determinant factorization and height bound (exists_chainDeterminant_eq_pow_mul_prod_liftDeterminant, exists_div_chainDeterminant_one_eq, exists_chainDeterminant_pos_and_div_chainDeterminant_one_eq, HasSmallRatios.heightLe_inv_rpow_mul_prod_quotientRatio): Taking determinants in exists_adjoint_chain_comp_eq_smul_rallisProduct and substituting exists_normDet_goodLift_sq_eq cancels cQmd; dividing by ϑ=1 cancels Cd. Each pair 1≤i<j≤m (at most m2 pairs by card_sigma_Ioc_le) is a ramified ratio of t critical L-value ratios, so HasSmallRatios θ bounds the inverse scalar height by D.m * D.m * (D.t * D.x₁).
  5. Eigenform spanning interface (range_tupleIdem_le, singleLift_asAlgebraHom, range_goodLift_le): Equivariance of D.singleLift ϑ j with D.chosenGL (singleLift_asAlgebraHom) shows that (D.goodLift ϑ j).range is spanned by lifts of good Hecke eigenforms landing in the range of some good tupleIdem D.RowIndex c.

2. Two-grid turns and short auxiliary lifts (SpanningForms.lean, 29 decls, 0 truncations) ​

  1. Last-path p-integrality (lastPathBound, liftDenominator, liftDenominator_smul_lastPathEdgeDatum_mem_raises, generator_inv_mul_normQ_mul_star_mem, norm_mul_det_flipScalar_zpow_le_one, exists_norm_mul_lastPathPairing_le_one, exists_mul_lastPathPeriod_mem_embValRing): Clears every edge kernel on the last path at primes p∤Nm(Q) by D.liftDenominator (a product of powers of M and P.d), controls the flip scalar u=tα―/(tα) at the middle branching pairing (log⁡N≤x98b2), and concludes that 0<N≤exp⁡(x99b2) clears lastPathPeriod Ψ y into embValRing.
  2. Last-path archimedean conjugates (card_stdClasses_lastPathLevel_le, sqrt_weylNormSq_lastPathKernel_le, norm_lastPathPeriod_le): At ϑ=1, class numbers and single-edge kernel operator norms are each bounded by exp⁡(x99b2), yielding ∥σ(lastPathPeriod Ψ y)∥≤exp⁡(x200b2)BfalseBtrue for all σ∈Aut(C).
  3. Period transfer and delta-form readout (exists_integral_lowerChainUpTo_eq_lastPathPeriod, DualVector, dualPairing, isDualPairing_dualPairing, dualHook, dualHook_mul_exp_le, mem_embValRing_of_dualPairing_eq_dualHook_mul, weylNormSq_le_of_dualPairing, lastPathDelta, lastPathConjDelta, lastPathToAlgForm_lastPathConjDelta, fixedByOuterLevels_lastPathConjDelta, integral_lastPathConjDelta_mul, weylGauge_lastPathConjDelta_le_one, weylNormSq_lastPathConjDelta_le, exists_dualPairing_eq_mul_lastPathPeriod):exists_integral_lowerChainUpTo_eq_lastPathPeriod imports the m2-turn transfer from DiagonalTurns.lean. Inserting the dual-weight delta form δx(v)=lastPathConjDelta ϑ x v supported on the class of x uses Schur orthogonality (integral_lastPathConjDelta_mul, dividing by the weight dimension card (WeylIndex (D.Y D.m) D.columnsY)) to express the dual pairing with ((c(ϑ)/c(1))lowerChain ϑ (rφ))(x) directly as β⋅lastPathPeriod (exists_dualPairing_eq_mul_lastPathPeriod).
  4. Spanning by short lifts (exists_lowerChain_integral_and_weylNormSq_le, span_isShort_eq_top_gridLevelForms, exists_span_short_lifts_eq_top): Duality recovers coordinate-wise p-integrality (clearing D.dualHook) and weylNormSq bounds (exp⁡(2x201b2)⋅B). Feeding the short spanning family on Y~0m (span_isShort_eq_top_gridLevelForms, bound exp⁡(x99b2)) through the surjective restriction r establishes New.Data.exists_span_short_lifts_eq_top with archimedean bound exp⁡(x202b2).
Level 3 · Formal Lean Contract

Level 3 — Formal Lean Contract ​

The extracted skeletons skeleton/05_determinant/norm_of_chain.lean (24 declarations, 1 stub truncation) and skeleton/05_determinant/spanning_forms.lean (29 declarations, 0 stub truncations) mirror src/New/Determinant/Chain/NormOfChain.lean and src/New/Determinant/AuxiliaryForms/SpanningForms.lean at pinned upstream commit 41c2716658c42ba08eb0648994a2efe83082a95c.

Critical Honesty Disclosure: One let u := Stub Truncation in norm_of_chain.lean ​

In skeleton/05_determinant/norm_of_chain.lean, New.Data.exists_inner_weightedChain_eq (L86) introduces a let u := binding inside its return type, causing rh-extract to truncate the extracted stub immediately at let u := by sorry. Its exact untruncated statement from upstream src/New/Determinant/Chain/NormOfChain.lean:162–171 (41c2716658c4) is quoted verbatim below:

lean
-- Upstream: src/New/Determinant/Chain/NormOfChain.lean:162-171
-- (truncated at `let u :=` in skeleton/05_determinant/norm_of_chain.lean:86)
lemma exists_inner_weightedChain_eq :
    ∃ κ : D.MFoldTwist → ℂ,
      D.HasAbsUpToNormPower κ (∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j) ∧
      ∀ (ϑ : D.MFoldTwist) (x y : D.targetForms),
        let u := Exchange.weightedChain (D.triangleGLCard false) (D.triangleLift false) ϑ 0 D.m
        inner ℂ (u x.val.val) (u y.val.val) =
          κ ϑ * (triangleGLCard false ϑ 0 * triangleGLCard false ϑ 1 ^ D.m /
            triangleGLCard false ϑ D.m) /
            Fintype.card (D.Y 1 × D.RowIndex → (D.twistModulus ϑ 1).ResidueRing) ^ D.m *
            inner ℂ x (D.rallisProduct ϑ y)

All 23 remaining declarations in norm_of_chain.lean and all 29 declarations in spanning_forms.lean extract completely untruncated.

Untruncated Headline Signatures ​

From skeleton/05_determinant/norm_of_chain.lean and skeleton/05_determinant/spanning_forms.lean:

lean
theorem New.Data.exists_chainDeterminant_pos_and_div_chainDeterminant_one_eq :
    ∃ e : ℤ, ∀ ϑ : D.MFoldTwist,
      0 < D.chainDeterminant ϑ ∧
      (∀ j : D.LiftIndex, 0 < D.liftDeterminant ϑ j) ∧
      D.chainDeterminant ϑ / D.chainDeterminant 1 =
        (((ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
            ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ : ℝ) : ℂ) ^ D.targetDim *
          ∏ j ∈ Icc 1 D.m, D.liftDeterminant ϑ j / D.liftDeterminant 1 j

lemma New.Data.HasSmallRatios.heightLe_inv_rpow_mul_prod_quotientRatio {D : Data P}
    {θ : PrimePadicIso → D.MFoldTwist} (hθ : D.HasSmallRatios θ) (e : ℤ) :
    HeightLe (D.m * D.m * (D.t * D.x₁)) fun ι : PrimePadicIso ↦
      ((((θ ι).normQ : ℝ) ^ (e / 2 : ℝ) *
        ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j (θ ι) : ℝ) : ℂ)⁻¹

lemma New.Data.exists_span_short_lifts_eq_top : ∃ c : D.MFoldTwist → ℂˣ,
    D.HasAbsUpToNormPower (fun ϑ : D.MFoldTwist ↦ c ϑ)
      (∏ i ∈ range D.m, ∏ j ∈ range D.m, D.turnRatio i j) ∧
    span ℂ {y : D.principalForms (D.spaceY 0) |
      (∀ (ϑ : D.MFoldTwist) (l : ℕ) [Fact l.Prime] (place : PadicPlace l), l.Coprime ϑ.normQ →
        (c ϑ / c 1 : ℂ) • D.lowerChainAtLevel ϑ y ∈ integralForms (l := l) place) ∧
      ∀ (σ : ℂ ≃+* ℂ) (g : Gf D.E (D.Y D.m)),
        weylNormSq (σ ∘ (D.lowerChain .one y).val g) ≤ exp (D.x ^ 202 * D.b ^ 2)} = ⊤
  • Verification status (audit/verification-status.json): Local Lean compilation and kernel replay remain build_status: unverified-locally at pinned commit 41c2716658c42ba08eb0648994a2efe83082a95c (41c2716658c4). Static token scanning has scan_scope: entry, covering only Challenge.lean, src/Main.lean, and src/Statements.lean (0 forbidden tokens in solution files, 5 expected sorry tokens in Challenge.lean). Neither NormOfChain.lean nor SpanningForms.lean has been locally compiled, kernel-checked, or statically scanned here.

lemma New.normDet_sq_eq_pow_mul_det — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L64-L73)

lean
/-- Let `u : U →ₗ[ℂ] V` be a linear map between finite-dimensional complex inner product spaces `U`
and `V`, and `S` an endomorphism of `U` with `⟪u x, u y⟫ = a ⟪x, S y⟫` for all `x`, `y`. Then
`u.normDet ^ 2`, the volume det(u* u), equals `a ^ finrank ℂ U * S.det`. -/
lemma New.normDet_sq_eq_pow_mul_det [Module.Finite ℂ U] (u : U →ₗ[ℂ] V) (S : End ℂ U) {a : ℂ}
    (h_gram : ∀ x y : U, inner ℂ (u x) (u y) = a * inner ℂ x (S y)) :
    u.normDet ^ 2 = a ^ finrank ℂ U * S.det := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:64-73 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=5 body_sha256=4e49934ecf5a0d0543765879f1d5c2939d05fb7bacbc733a053fbd4c9af74f9c]

def New.Data.liftDeterminant — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L75-L77)

lean
/-- The volume `liftDeterminant ϑ j` = det(u* u) = `u.normDet ^ 2` of the lift u = `singleLift` at
`j` for the twist ϑ^j, restricted to the good forms on U(W_j) (`New.Data.goodLift`). -/
def New.Data.liftDeterminant (ϑ : D.MFoldTwist) (j : ℕ) : ℂ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:75-77 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=01ea31d2055b1608b35bb1f064dc12e4cf896d2110b9af0bb27088ff7a8eec7e]

theorem New.Data.normDet_goodLift_sq_pos — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L79-L85)

lean
/-- For `1 ≤ j ≤ m` and every tame character `ϑ`, the volume `det(u* u) = u.normDet ^ 2` is
positive, where `u` is the lift from `W_j` for `ϑ`, restricted to the good forms: the lift is
injective. -/
theorem New.Data.normDet_goodLift_sq_pos (ϑ : D.TameChar) (j : D.LiftIndex) :
    0 < (D.goodLift ϑ j).normDet ^ 2 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:79-85 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=e5b1f883c2f2991c08376bd95c774c6f6ea2a3f210006c4db409bab9cf62b4e4]

theorem New.Data.liftDeterminant_pos — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L88-L92)

lean
/-- For `1 ≤ j ≤ m` the volume of the lift from `W_j` for the twist `ϑ ^ j`, restricted to the good
forms, is a positive real number. -/
theorem New.Data.liftDeterminant_pos (ϑ : D.MFoldTwist) (j : D.LiftIndex) : 0 < D.liftDeterminant ϑ j := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:88-92 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=c483297d86717fa4655fd6562485048b452c65221c70bbfc680b04214d9bd7f6]

abbrev New.Data.Θ — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L94-L102)

lean
/-- The map ι_ϑ (`New.Data.lowerChainAtLevel`) restricted to the target forms, that is to the good
forms on Y₀. It takes values in the algebraic forms on Y_m whose weight has `columnsY` columns of
each height and last entry `lastEntry m`, and whose level is given by `lastResidueLevel` (trivial at
the chosen places, block upper triangular at the places of the twist) with the character
`lastLevelChar` made of the tame characters of the lifts on the diagonal blocks. -/
abbrev New.Data.Θ (ϑ : D.MFoldTwist) :
    D.targetForms →ₗ[ℂ] (D.levelPlaces ϑ.toTameChar).LevelForm (lastResidueLevel ϑ.toTameChar)
      (lastLevelChar ϑ.toTameChar) D.columnsY (D.lastEntry D.m) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:94-102 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=61e8b0b4b4c4b83bf6e55963d0ca46f45f5503b7424942712d6f0799830cac3c]

def New.Data.chainDeterminant — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L104-L107)

lean
/-- The volume `chainDeterminant ϑ` = det(u*u) of u = ι_ϑ (`New.Data.lowerChainAtLevel`), the map
from forms of principal level on Y₀ to forms on Y_m, restricted to the target forms (the good forms
on Y₀). -/
def New.Data.chainDeterminant (ϑ : D.MFoldTwist) : ℂ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:104-107 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=313f816dce2f62b152afe386e26dce697de9f791c62e31c4e8854d2a62e3f922]

theorem New.Data.chainDeterminant_pos — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L110-L116)

lean
/-- For every m-fold twist `ϑ : D.MFoldTwist`, `D.chainDeterminant ϑ` is a positive real number.
This is the volume det(u* u) of the map u = ι_ϑ from forms on Y₀ to forms on Y_m, restricted to the
target forms. So this map is injective. -/
theorem New.Data.chainDeterminant_pos (ϑ : D.MFoldTwist) : 0 < D.chainDeterminant ϑ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:110-116 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=4 body_sha256=b59817e79000386f0d7c639de50340b92ebb5caf7b51cb2b4c0949f9070cbec0]

lemma New.Data.exists_normDet_goodLift_sq_eq — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L118-L141)

lean
/-- For `j : D.LiftIndex`, so `1 ≤ j ≤ m`, there is a constant `A ≠ 0` with the following property.
For every tame character `ϑ`, let `u = D.goodLift ϑ j` be the lift `singleLift` restricted to the
good forms on `W_j = D.spaceW j`. Then its volume `normDet ^ 2 = det(u* u)` is `(A c_Q) ^ targetDim`
times a determinant, where `targetDim` is the dimension of the target forms. That determinant is the
one of `rallisOnGood`, the series of Rallis' formula for the `j`-th lift for `ϑ`, acting as a
spherical Hecke operator on the target forms, the good forms on `Y₀ = D.spaceY 0`. Here `c_Q` is the
constant `New.DescentPair.twistFactor` of `D.descentPair ϑ j`, the pair of spaces and the data of
that lift. -/
lemma New.Data.exists_normDet_goodLift_sq_eq (j : D.LiftIndex) :
    ∃ A : ℂ, A ≠ 0 ∧ ∀ ϑ : D.TameChar,
      ((D.goodLift ϑ j).normDet : ℂ) ^ 2 =
        (A * (D.descentPair ϑ j).twistFactor) ^ D.targetDim *
          (D.rallisOnGood (D.spaceY 0) ϑ j).det := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:118-141 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=12 body_sha256=d8f3c6fdea5ff4b8a94da81fd0f89b1ee948aa05b92d77ecff0dc4d16592c5da]

def New.Data.rallisProduct — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L143-L147)

lean
/-- The product, in the order `j = 1, …, m`, of the operators `rallisOnGood` on the target forms for
the twists `ϑ ^ j` and the indices `j`. The `j`-th one is the series of Rallis' formula for the
`j`-th lift at `ϑ ^ j`, which acts as a spherical Hecke operator. -/
def New.Data.rallisProduct (ϑ : D.MFoldTwist) : End ℂ D.targetForms := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:143-147 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=b5372fb270eaeefaa26201a1c9d382d369dc04f721555c9c7906977f32d45cb1]

lemma New.Data.exists_inner_weightedChain_eq — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L149-L202)

lean
/-- The squared norm of the weighted chain of lifts. The triangle of lifts is a triangular array of
spaces of forms, with theta lifts `triangleLift` from position `(i, n)` to position `(i, n + 1)`;
the flag `false` picks one of the two triangles, the one whose characters are twisted by powers of
`ϑ`. The chain of its first `m` lifts from `Y₀`, each times its weight `triangleGLCard`
(`Exchange.weightedChain`), is taken on the target forms. Its Gram form is `κ ϑ` times a ratio of
group orders, divided by the `m`-th power of the number of matrices modulo `D.twistModulus ϑ 1`
indexed by `D.Y 1 × D.RowIndex`, times the form of `New.Data.rallisProduct`. Here
`triangleGLCard false ϑ n` is the order of the general linear group in the `n`-th place of the
triangle over the residue ring of its modulus, and `D.twistModulus ϑ 1` is the product of the chosen
places and the places of the twist. The statement `HasAbsUpToNormPower κ f` says
`‖κ ϑ‖² = C (normQ ϑ)^k (f ϑ)²` with `C` and `k` independent of `ϑ`; here `f` is the product over
`1 ≤ i < j ≤ m` of `quotientRatio i j`, the ratios of Hecke values of the quotient of the `j`-th and
`i`-th lift characters at `ϑ ^ (j - i)`. -/
lemma New.Data.exists_inner_weightedChain_eq :
    ∃ κ : D.MFoldTwist → ℂ,
      D.HasAbsUpToNormPower κ (∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j) ∧
      ∀ (ϑ : D.MFoldTwist) (x y : D.targetForms),
        let u := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:149-202 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=37 body_sha256=bf13e44aa7c46ae09de38078cb78ca6f2c655f7dee149382077d1dff5486ceeb]

theorem New.Data.exists_inner_chain_eq — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L204-L250)

lean
/-- The Gram form of the chain. For an `m`-fold twist `ϑ` let `Θ = D.Θ ϑ` be the chain of lifts from
forms on `Y₀` to forms on `Y_m`, restricted to the target forms. There are numbers `c ϑ`, a real `C`
(possibly `0`) and an integer `k` such that for all `ϑ`
* `‖c ϑ‖ ^ 2 = C (Nm Q) ^ k (∏_{1 ≤ i < j ≤ m} quotientRatio i j ϑ) ^ 2` (`HasAbsUpToNormPower`),
* `⟪Θ x, Θ y⟫ = c ϑ * c_Q ^ m * ⟪x, R y⟫` for all target forms `x` and `y`.

Here `Q` is the set of places of `ϑ` and `Nm Q = ϑ.normQ` the product of their norms `q_w`. The
operator `R = D.rallisProduct ϑ` is the product over `1 ≤ j ≤ m` of the series of Rallis' formula
for the `j`-th lift at `ϑ ^ j`. The number `c_Q = (D.descentPair ϑ 1).twistFactor` is
`(Nm Q) ^ (r t) ∏_{w ∈ Q} ∏_{t < i ≤ t + r} (1 - q_w ^ (-i))`, and `quotientRatio i j ϑ` is the
product of the ratios of Hecke values of the quotient of the `j`-th and `i`-th lift characters at
`ϑ ^ (j - i)`. -/
theorem New.Data.exists_inner_chain_eq :
    ∃ c : D.MFoldTwist → ℂ,
      D.HasAbsUpToNormPower c (∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j) ∧
      ∀ (ϑ : D.MFoldTwist) (x y : D.targetForms), inner ℂ (D.Θ ϑ x) (D.Θ ϑ y) =
        c ϑ * (D.descentPair ϑ 1).twistFactor ^ D.m * inner ℂ x (D.rallisProduct ϑ y) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:204-250 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=31 body_sha256=10223a1bd45534952429542db0734a358682edc1820c7ab2f5e488e8f0c6d1e9]

lemma New.Data.isRamifiedRatio_of_mem_sigma — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L252-L261)

lean
/-- Let `ij = (i, j)` be a pair with `1 ≤ i < j ≤ m` and `χ_j = D.untwistedLiftChar j` the character
of the `j`-th lift without twist. Then `quotientRatio i j`, the product of the ratios of Hecke
values of `χ_j / χ_i`, is a ramified ratio: for some fixed `1 ≤ n ≤ m` and some ramified pair (a
character ramified at the chosen places and an integer `z`, the ratios taken at `1, …, z`), its
value at a twist `ϑ` is the product of the ratios of Hecke values of that pair at `ϑ ^ n`. -/
lemma New.Data.isRamifiedRatio_of_mem_sigma {ij : Σ _ : ℕ, ℕ}
    (hij : ij ∈ (Ioc 0 D.m).sigma fun i : ℕ ↦ Ioc i D.m) :
    D.IsRamifiedRatio (D.quotientRatio ij.1 ij.2) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:252-261 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=53077c3aa758059483c1d7d9761a529d84ddd7f199de1d66d987a218f04e7c5b]

lemma New.Data.card_sigma_Ioc_le — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L263-L265)

lean
/-- There are at most `m²` pairs `1 ≤ i < j ≤ m`. -/
lemma New.Data.card_sigma_Ioc_le (m : ℕ) : #((Ioc 0 m).sigma fun i : ℕ ↦ Ioc i m) ≤ m * m := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:263-265 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=1dc30fe3d518b09ab12f7ef4988880eb070069dbf3a91fc68c5981c630f3bcd8]

lemma New.Data.prod_quotientRatio_one — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L267-L272)

lean
/-- At the trivial twist the product of the ratios `quotientRatio i j` over `1 ≤ i < j ≤ m` is
`1`. -/
lemma New.Data.prod_quotientRatio_one :
    ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j 1 = 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:267-272 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=20a4f4a95fb3db43ce1de6737563f2dd67a3cde7e5828eba81912a25e080c935]

lemma New.Data.prod_quotientRatio_nonneg — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L274-L279)

lean
/-- At every m-fold twist `ϑ : D.MFoldTwist`, the product of the ratios `D.quotientRatio i j ϑ` over
`1 ≤ i < j ≤ m` is nonnegative. -/
lemma New.Data.prod_quotientRatio_nonneg (ϑ : D.MFoldTwist) :
    0 ≤ ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:274-279 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=aa43871974a1b2f22678dbe79d4dd5112a0fa26c4531a204370918347d1c346a]

lemma New.Data.HasAbsUpToNormPower.exists_norm_div_eq_mul_prod_quotientRatio — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L281-L293)

lean
/-- Let `c` satisfy `HasAbsUpToNormPower c f`, that is `‖c ϑ‖² = C (normQ ϑ)^k (f ϑ)²` with `C` and
`k` independent of `ϑ`, where `f` is the product of the ratios of Hecke values `quotientRatio i j`
over `1 ≤ i < j ≤ m`, and let `c 1 ≠ 0`. Then `‖c ϑ / c 1‖` is `normQ ϑ ^ (e / 2)` times the product
of the `quotientRatio i j ϑ`, for an integer `e` independent of the twist `ϑ`. -/
lemma New.Data.HasAbsUpToNormPower.exists_norm_div_eq_mul_prod_quotientRatio {D : Data P}
    {c : D.MFoldTwist → ℂ}
    (h_modulus : D.HasAbsUpToNormPower c (∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j))
    (hc : c 1 ≠ 0) :
    ∃ e : ℤ, ∀ ϑ : D.MFoldTwist, ‖c ϑ / c 1‖ =
      (ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
        ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:281-293 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=cf5b56483067384bd38c7a5e0d83f689628d5dc271424079052a686b8749bf12]

theorem New.Data.exists_adjoint_chain_comp_eq_smul_rallisProduct — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L295-L346)

lean
/-- **Norm of the chain.** For an `m`-fold twist `ϑ` let `Θ = D.Θ ϑ` be the chain of lifts from
forms on `Y₀` to forms on `Y_m`, restricted to the target forms. There are a constant `C > 0`, an
integer `e` and numbers `c ϑ` such that for all `ϑ`
* `‖c ϑ‖ = C (Nm Q) ^ (e / 2) ∏_{1 ≤ i < j ≤ m} quotientRatio i j ϑ`, and
* `Θ* Θ = c ϑ * c_Q ^ m * R`.

Here `Q` is the set of places of `ϑ` and `Nm Q = ϑ.normQ` the product of their norms `q_w`. The
operator `R = D.rallisProduct ϑ` is the product over `1 ≤ j ≤ m` of the series of Rallis' formula
for the `j`-th lift at `ϑ ^ j`. The number `c_Q = (D.descentPair ϑ 1).twistFactor` is
`(Nm Q) ^ (r t) ∏_{w ∈ Q} ∏_{t < i ≤ t + r} (1 - q_w ^ (-i))`, and `quotientRatio i j ϑ` is the
product of the ratios of Hecke values of the quotient of the `j`-th and `i`-th lift characters at
`ϑ ^ (j - i)`. -/
theorem New.Data.exists_adjoint_chain_comp_eq_smul_rallisProduct (D : Data P) :
    ∃ (C : ℝ) (e : ℤ) (c : D.MFoldTwist → ℂ),
      0 < C ∧
      (∀ ϑ : D.MFoldTwist, ‖c ϑ‖ = C * ((ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
        ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ)) ∧
      ∀ ϑ : D.MFoldTwist, (D.Θ ϑ).adjoint ∘ₗ D.Θ ϑ =
        (c ϑ * (D.descentPair ϑ 1).twistFactor ^ D.m) • D.rallisProduct ϑ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:295-346 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=34 body_sha256=ec891dde1e97004d952cbd50f5c33b9e5223207876deafb60e895a4e8f6b743d]

lemma New.Data.exists_chainDeterminant_eq_pow_mul_prod_liftDeterminant — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L348-L395)

lean
/-- There are a constant `C > 0` and an integer `e` such that for every `m`-fold twist `ϑ` `det (Θ*
Θ) = (C (Nm Q) ^ (e / 2) ∏_{1 ≤ i < j ≤ m} quotientRatio i j ϑ) ^ d ∏_{1 ≤ j ≤ m} λ_j`. Here
`Θ = D.Θ ϑ` is the chain of lifts from forms on `Y₀` to forms on `Y_m`, restricted to the target
forms (the good forms on `Y₀`, of dimension `d = D.targetDim`), and `det (Θ* Θ)` is
`D.chainDeterminant ϑ`. The number `λ_j = D.liftDeterminant ϑ j` is `det (u* u)` for the `j`-th
single lift `u` at `ϑ ^ j` on the good forms (`goodLift`), `Nm Q = ϑ.normQ` is the product of the
norms of the places of `ϑ`, and `quotientRatio i j ϑ` is the product of the ratios of Hecke values
of the quotient of the `j`-th and `i`-th lift characters at `ϑ ^ (j - i)`. -/
lemma New.Data.exists_chainDeterminant_eq_pow_mul_prod_liftDeterminant :
    ∃ (C : ℝ) (e : ℤ), 0 < C ∧ ∀ ϑ : D.MFoldTwist,
      D.chainDeterminant ϑ =
        ((C * ((ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
            ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ) : ℝ) : ℂ) ^ D.targetDim *
          ∏ j ∈ Icc 1 D.m, D.liftDeterminant ϑ j := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:348-395 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=35 body_sha256=f133c341356c4c3ebda37166eab95bbf0c606d9c4930b6577506bef1dc113cbc]

theorem New.Data.exists_div_chainDeterminant_one_eq — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L397-L415)

lean
/-- There is an integer `e` such that, for every twist `ϑ` whose first `m` powers are twists, the
ratio `chainDeterminant ϑ / chainDeterminant 1` is `(normQ ϑ ^ (e / 2) * ∏_{1 ≤ i < j ≤ m}
quotientRatio i j ϑ) ^ targetDim` times the product over `1 ≤ j ≤ m` of the ratios
`liftDeterminant ϑ j / liftDeterminant 1 j`. -/
theorem New.Data.exists_div_chainDeterminant_one_eq :
    ∃ e : ℤ, ∀ ϑ : D.MFoldTwist,
      D.chainDeterminant ϑ / D.chainDeterminant 1 =
        (((ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
            ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ : ℝ) : ℂ) ^ D.targetDim *
          ∏ j ∈ Icc 1 D.m, D.liftDeterminant ϑ j / D.liftDeterminant 1 j := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:397-415 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=10 body_sha256=3bcd4d0770f0103c2cd79285e49d96c46c19e7b51e6efa831befcd96cc1674bf]

theorem New.Data.exists_chainDeterminant_pos_and_div_chainDeterminant_one_eq — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L418-L435)

lean
/-- **Factorization of the determinant.** For the data `D`, let `ϑ` be an `m`-fold twist
(`MFoldTwist`): a twist whose tame part has `ψ_wⁿ` nontrivial for all `w` in `Q` and `1 ≤ n ≤ m`.
Let `Θ = D.Θ ϑ` be the chain of lifts restricted to the target forms, and `u = goodLift` the lift at
`1 ≤ j ≤ m` for `ϑ ^ j`, restricted to the good forms on W_j. Then the volumes
`chainDeterminant ϑ` = det(Θ* Θ) and `liftDeterminant ϑ j` = det(u* u), with * the adjoint, are
positive. The ratio `chainDeterminant ϑ / chainDeterminant 1` is `(normQ ϑ ^ (e / 2) * ∏_{i < j}
quotientRatio i j ϑ) ^ targetDim` times the product of the ratios
`liftDeterminant ϑ j / liftDeterminant 1 j`, with an integer `e` independent of `ϑ`. -/
theorem New.Data.exists_chainDeterminant_pos_and_div_chainDeterminant_one_eq :
    ∃ e : ℤ, ∀ ϑ : D.MFoldTwist,
      0 < D.chainDeterminant ϑ ∧
      (∀ j : D.LiftIndex, 0 < D.liftDeterminant ϑ j) ∧
      D.chainDeterminant ϑ / D.chainDeterminant 1 =
        (((ϑ.normQ : ℝ) ^ (e / 2 : ℝ) *
            ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j ϑ : ℝ) : ℂ) ^ D.targetDim *
          ∏ j ∈ Icc 1 D.m, D.liftDeterminant ϑ j / D.liftDeterminant 1 j := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:418-435 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=3 body_sha256=a3717854cdfc288badceb978d2677dfe65c55fcef36a1b2230c8d04fed9d5027]

lemma New.Data.HasSmallRatios.heightLe_inv_rpow_mul_prod_quotientRatio — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L437-L453)

lean
/-- Let `θ` be a family of twists indexed by the isomorphisms `ι : ℂ ≃ ℚ̄_l` for primes `l`, with
small ratios: `normQ (θ ι)`, the product of the norms of the places of the twist, is prime to `l`,
and for every ramified pair the inverse ratios of L-values at the powers `(θ ι) ^ (±j)`,
`1 ≤ j ≤ m`, have height at most `D.x₁`, the second cut-off of the data. Then the inverses of `normQ
^ (e / 2) * ∏_{1 ≤ i < j ≤ m} quotientRatio i j` at the `θ ι` form a family of height at most
`m² * D.t * D.x₁`. -/
lemma New.Data.HasSmallRatios.heightLe_inv_rpow_mul_prod_quotientRatio {D : Data P}
    {θ : PrimePadicIso → D.MFoldTwist} (hθ : D.HasSmallRatios θ) (e : ℤ) :
    HeightLe (D.m * D.m * (D.t * D.x₁)) fun ι : PrimePadicIso ↦
      ((((θ ι).normQ : ℝ) ^ (e / 2 : ℝ) *
        ∏ i ∈ Ioc 0 D.m, ∏ j ∈ Ioc i D.m, D.quotientRatio i j (θ ι) : ℝ) : ℂ)⁻¹ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:437-453 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=7 body_sha256=315809a0804c6ac3ced4687eae63fb58f626676af9efb5abc708168f1051afe4]

lemma New.Data.range_tupleIdem_le — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L456-L470)

lean
/-- Let `f` be a representation of the group algebra of `D.chosenGL`, the product of the finite
general linear groups at the chosen places, on a complex inner product space `U`. Let `c` be a good
tuple family: one of the finitely many admissible labellings of the chosen places by polynomials
over their residue fields. Then the range of the idempotent `tupleIdem D.RowIndex c` under `f` lies
in the range of `New.Data.e₀`, the sum of these idempotents over all good tuple families. -/
lemma New.Data.range_tupleIdem_le {f : MonoidAlgebra ℂ D.chosenGL →ₐ[ℂ] End ℂ U}
    {c : (x : Σ i : Fin 2, D.ChosenPlace i) → Polynomial (ResField (D.chosenPlace x))}
    (hc : c ∈ D.goodTupleFamilies) :
    (f (tupleIdem D.RowIndex c)).range ≤ (f D.e₀).range := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:456-470 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=7 body_sha256=af0ab1d70120e7ca1ac735ad46839061b48f91224653b5edf8f227caffb057d2]

lemma New.Data.singleLift_asAlgebraHom — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L474-L490)

lean
/-- The theta lift `D.singleLift ϑ j`, for a tame character `ϑ` and `1 ≤ j ≤ m`, commutes with the
group algebra of `D.chosenGL`, the product of the groups `GL_r` over the residue fields of the
chosen places. An element `x` acts through `principalRep` on `principalForms`, the forms on the
hermitian space `W_j = D.spaceW j` fixed by the principal level at the chosen places. It acts by
`groupAlgAction` on the forms on the larger space of `D.descentPair ϑ j`, the datum of the lift. -/
lemma New.Data.singleLift_asAlgebraHom {ϑ : D.TameChar} {j : D.LiftIndex} {x : MonoidAlgebra ℂ D.chosenGL}
    (y : D.principalForms (D.spaceW j)) :
    D.singleLift ϑ j ((D.principalRep (D.spaceW j)).asAlgebraHom x y) =
      (D.descentPair ϑ j).groupAlgAction x (D.singleLift ϑ j y) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:474-490 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=9 body_sha256=4a0f861d8e6821c2deb38867cba8cbe6f59daef432459d96189458610385b664]

lemma New.Data.range_goodLift_le — Upstream source (src/New/Determinant/Chain/NormOfChain.lean L493-L529)

lean
/-- Let `ϑ` be a tame character and `1 ≤ j ≤ m`. The range of `D.goodLift ϑ j`, the lift
`singleLift` restricted to the good forms on `W_j = D.spaceW j`, is spanned by the lifts of good
eigenforms whose lifts lie in the range of the idempotent of a good tuple family. A good tuple
family `c` is one of the finitely many admissible labellings of the chosen places by polynomials
over their residue fields. `tupleIdem D.RowIndex c` is the tensor product of the idempotents
labelled by these polynomials in the group algebra of the finite groups at the chosen places, which
acts on forms by `groupAlgAction`. A good form is a form of principal level at the chosen places
that lies in the image of `e₀`, the sum of these idempotents over all good tuple families.
Precisely, let a subspace `N` of the forms `FormV` on the larger space of the pair
`D.descentPair ϑ j` contain the lift `singleLift ϑ j y` for every good form `y` in `eigenPart p`
whose lift lies in the range of some `tupleIdem D.RowIndex c`. Here `eigenPart p` is the joint
eigenspace of the Hecke operators for a system `p`. Then `N` contains the range of
`goodLift ϑ j`. -/
lemma New.Data.range_goodLift_le {ϑ : D.TameChar} {j : D.LiftIndex}
    {N : Submodule ℂ (D.descentPair ϑ j).FormV}
    (h_eigen : ∀ p : FinPlace D.E × ℕ → ℂ,
      ∀ y ∈ D.goodForms (D.spaceW j) ⊓ D.eigenPart (D.spaceW j) p, ∀ c ∈ D.goodTupleFamilies,
      D.singleLift ϑ j y ∈ (DescentPair.groupAlgAction (D.descentPair ϑ j)
        (tupleIdem D.RowIndex c)).range →
      D.singleLift ϑ j y ∈ N) :
    (D.goodLift ϑ j).range ≤ N := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/Chain/NormOfChain.lean:493-529 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=17 body_sha256=2702f85e4c6ae00a0c63c8ccc9cd4602ce23b7f8250cd0968d65607a29d03388]

abbrev New.Data.lastPathBound — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L63-L68)

lean
/-- The bound for the number of roots of unity in a value of the data on the last path: that for
the first path, times one factor for each of the `m ^ 2` turns. Here `vectorCountBound ϑ` bounds the
number of column vectors modulo `𝔪` at a node of the grids and `edgeMatrixCountBound ϑ` the number
of matrices modulo `𝔪` at an edge. -/
abbrev New.Data.lastPathBound (ϑ : D.MFoldTwist) : ℕ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:63-68 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=dc824d233ed39ab1c4b0dacd588a70dcb114dbb3071fe1445e3b0b256fbd6087]

def New.Data.liftDenominator — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L72-L78)

lean
/-- A product of powers of `M` and `P.d` that, at the primes not dividing `Nm Q`, clears the
denominators of each kernel on the last path. The first factor takes the datum of an edge to
standard data, and the second pays for the boxes of the diagram: `2 * D.n D.m` bounds the ranks on
that path and `D.natB * D.r ^ 4` the numbers of boxes. -/
def New.Data.liftDenominator : ℕ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:72-78 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=55b6d74268a502f6c3b61640e2cdd5bdcdb691fd0f6027d9d1e20b543056fa19]

lemma New.Data.liftDenominator_smul_lastPathEdgeDatum_mem_raises — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L84-L106)

lean
/-- Let `p` be a prime that does not divide the product `ϑ.normQ` of the norms of the set `Q` of
places of the `m`-fold twist `ϑ`, and fix an embedding of `ℂ` into `ℂ_[p]` (`PadicPlace p`). The
half `z` of the last path is a sequence of `m + 1` spaces, and the theta kernel
`lastPathKernel ϑ z j` lifts forms from the `j`-th to the next. For a tuple `S` of matrices on the
edges, the finite datum `lastPathEdgeDatum S z j` of this lift, multiplied by the number
`liftDenominator`, lies in `raises 1 1 1` of the kernel. The first two `1`s are translations of the
source point and of the target point, here trivial, and the third is a factor: for all finite points
`g` of the source and `h` of the target, the lift from `g` to `h` does not increase `p`-adic
gauges. -/
lemma New.Data.liftDenominator_smul_lastPathEdgeDatum_mem_raises {ϑ : D.MFoldTwist} {p : ℕ} [Fact p.Prime]
    [PadicPlace p] (hp : p.Coprime ϑ.normQ) (S : EdgeTuple ϑ) (z : Bool) {j : ℕ} (hj : j < D.m) :
    (D.liftDenominator : ℂ) • lastPathEdgeDatum S z j ∈ (lastPathKernel ϑ z j).raises 1 1 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:84-106 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=12 body_sha256=42fd987c59699a4fbd8aed991a0224fbae551d5a12c75ed2e2a7717714e4deeb]

lemma New.Data.generator_inv_mul_normQ_mul_star_mem — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L108-L127)

lean
/-- Let `t` be the idele that generates the modulus `𝔪 = gridModulus ϑ` of the `m`-fold twist `ϑ`
and `α = P.α D.towerExp` the fixed idele of the CM field `D.E`, for which `q₁ * α` and `α⁻¹` are
integral, with `q₁ = P.q₁ D.towerExp`. Write `star` for complex conjugation on the finite adeles of
`D.E`, `normQ` for the product of the norms of the places in the set `Q` of `ϑ`, `M = D.M` for the
level and `natB = D.natB` for the exponent of the chosen places in `𝔪`. The flip scalar
`u = star (t * α) / (t * α)` becomes an integral adele after multiplication by
`normQ * M ^ natB * q₁`. -/
lemma New.Data.generator_inv_mul_normQ_mul_star_mem (ϑ : D.MFoldTwist) :
    (gridModulus ϑ).generator⁻¹.val *
        algebraMap (NumberField.RingOfIntegers D.E) (Ô D.E) ↑(ϑ.normQ * D.M ^ D.natB) *
      (star ((gridModulus ϑ).generator.val * (P.q₁ D.towerExp * (P.α D.towerExp).val)) *
        (P.α D.towerExp)⁻¹.val) ∈
      Ô D.E := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:108-127 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=8 body_sha256=54d44698f259a3f0df2baebcf4b048b56e079a62103fd44e5e9369018fd40e54]

lemma New.Data.norm_mul_det_flipScalar_zpow_le_one — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L129-L156)

lean
/-- Let `ϑ` be an `m`-fold twist, `ϑ.normQ` the product of the norms of its places, and `p` a prime
that does not divide it. Let `u` be the flip scalar `star (t * α) / (t * α)` of the modulus
`gridModulus ϑ` (`t` generates the modulus, `α` is a fixed idele), as a `1 × 1` matrix (index type
`Unit`) over the finite adeles. For an infinite place `τ : D.Φ` of the CM field `D.E`, map the
matrix `(u ^ m)⁻¹` to `ℂ_[p]`. The map is the component at the prime above `p` of the embedding
`weightEmbedding ιₚ τ`. Let `δ` be the determinant of the image. For every integer `l`, the product
of `(M ^ natB * q₁) ^ (m * |l|)` and `(δ ^ l)⁻¹` has absolute value at most `1`. -/
lemma New.Data.norm_mul_det_flipScalar_zpow_le_one {ϑ : D.MFoldTwist} {p : ℕ} [Fact p.Prime] [PadicPlace p]
    (hp : p.Coprime ϑ.normQ) (τ : D.Φ) (l : ℤ) :
    ‖((D.M ^ D.natB * D.q₁) ^ (D.m * l.natAbs) : ℕ) *
      (((((gridModulus ϑ).flipScalar Unit).val ^ D.m)⁻¹.map
        (adeleExtension (weightEmbedding ιₚ τ))).det ^ l)⁻¹.val‖ ≤ 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:129-156 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=17 body_sha256=f398e72a115965240dc0c189c1c36ea731744422efbcfd3a1f36cbe7f264829a]

lemma New.Data.exists_norm_mul_lastPathPairing_le_one — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L162-L219)

lean
/-- The pairing `lastPathPairing v' v = v' ⬝ᵥ lastPathBranching *ᵥ v` of the two halves at the
middle of the last path, given by an integer branching matrix, is cleared by one natural number
`N ≠ 0` with `log N ≤ x ^ 98 * b ^ 2`. For every twist `ϑ` and every prime `p` prime to the norm
`ϑ.normQ` of its places, if `v'` has gauge at most `1` at `g` and `v` at the block point
`lastPathBlockPoint ϑ g = diag (g, u ^ m)`, with `u` the flip scalar of the modulus `gridModulus ϑ`,
then `N` times the pairing of `v'` and `v`, read `p`-adically by `ιₚ`, is integral. -/
lemma New.Data.exists_norm_mul_lastPathPairing_le_one : ∃ N ≠ (0 : ℕ),
    log N ≤ D.x ^ 98 * D.b ^ 2 ∧
    ∀ {ϑ : D.MFoldTwist} {p : ℕ} [Fact p.Prime] [PadicPlace p], p.Coprime ϑ.normQ →
      ∀ {g : Gf D.E (D.LastPathIndex false D.m)} {v' : D.LastPathVector false D.m}
        {v : D.LastPathVector true D.m},
        weylGauge (D.lastPathColumns false) (D.lastPathDetExp false D.m) g v' ≤ 1 →
        weylGauge (D.lastPathColumns true) (D.lastPathDetExp true D.m) (lastPathBlockPoint ϑ g) v ≤
          1 →
        ‖ιₚ (N * D.lastPathPairing v' v)‖ ≤ 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:162-219 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=44 body_sha256=0553c60f5bec37141fff205fe7abd1c6fdc705134c6de21eb8582176f95cb994]

lemma New.Data.exists_mul_lastPathPeriod_mem_embValRing — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L221-L274)

lean
/-- There is a natural number `0 < N ≤ exp (x ^ 99 * b ^ 2)`, with `x = D.x` and `b = D.b` the size
parameters of the data, such that for every twist `ϑ`, path datum `Ψ` on the last path, pair of
forms `y` fixed by the levels at the outer ends of the two halves and prime `p` prime to the norm
`ϑ.normQ` of the places of `ϑ`: if both forms, read as algebraic forms by `lastPathToAlgForm`, have
gauge at most `1` at every point, then `N * lastPathPeriod Ψ y` lies in `embValRing`, the ring of
`p`-integral complex numbers. -/
lemma New.Data.exists_mul_lastPathPeriod_mem_embValRing : ∃ N ≠ (0 : ℕ),
    N ≤ exp (D.x ^ 99 * D.b ^ 2) ∧
    ∀ {ϑ : D.MFoldTwist} {n : ℕ} {Ψ : EdgeTuple ϑ → ℂ} {y : ∀ z : Bool, D.GridForm z 0 D.m}
      {p : ℕ} [Fact p.Prime] [PadicPlace p],
      IsPathDatum n (TwoGridPath.last D.m).edges Ψ → FixedByOuterLevels ϑ y →
      p.Coprime ϑ.normQ →
      (∀ (z : Bool) (g : Gf D.E (D.LastPathIndex z 0)),
        weylGauge (D.lastPathColumns z) (D.lastPathDetExp z 0) g
          ((D.lastPathToAlgForm z (y z)).val g) ≤ 1) →
      N * lastPathPeriod Ψ y ∈ embValRing := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:221-274 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=39 body_sha256=256b125ed7c8897a08de02fe99681a9cf548170ea43eb7b3f4b2685d293294b8]

lemma New.Data.card_stdClasses_lastPathLevel_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L278-L288)

lean
/-- For the trivial twist, the class numbers of the levels along the last path are at most
`exp (x ^ 99 * b ^ 2)`. -/
lemma New.Data.card_stdClasses_lastPathLevel_le (z : Bool) {j : ℕ} (hj : j ≤ D.m) :
    Nat.card (StdClasses (lastPathLevel (1 : D.MFoldTwist) z j)) ≤ exp (D.x ^ 99 * D.b ^ 2) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:278-288 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=8 body_sha256=95acdff452226a6f9ba7baa7f435467aac7e53656ddafe5d013dd63552c93426]

lemma New.Data.sqrt_weylNormSq_lastPathKernel_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L290-L322)

lean
/-- For the trivial twist, the theta kernel `lastPathKernel 1 z j` lifts forms from the `j`-th to
the next space of the half `z` of the last path. Let `S` be a tuple of matrices on the edges. The
operator by which the datum `lastPathEdgeDatum S z j` of this edge carries a value `v` at the point
`g` to a value at `h` multiplies the norm `√(weylNormSq ·)` of the `σ`-conjugate of `v` by at most
`exp (x ^ 99 * b ^ 2)`, for each `σ` in `Aut(ℂ)`. -/
lemma New.Data.sqrt_weylNormSq_lastPathKernel_le (σ : ℂ ≃+* ℂ) (S : EdgeTuple (1 : D.MFoldTwist)) (z : Bool)
    {j : ℕ} (hj : j < D.m) (g : Gf D.E (D.LastPathIndex z j))
    (h : Gf D.E (D.LastPathIndex z (j + 1))) (v : D.LastPathVector z j) :
    √(weylNormSq
        (σ ∘ (lastPathKernel 1 z j).jetMap
          ((lastPathKernel 1 z j).ω (g, h) (lastPathEdgeDatum S z j)) v)) ≤
      exp (D.x ^ 99 * D.b ^ 2) * √(weylNormSq (σ ∘ v)) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:290-322 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=22 body_sha256=4e4354ed0438003251b647d60c589e23c87fdd7f929630b727d91a27ec690e1a]

lemma New.Data.norm_lastPathPeriod_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L324-L388)

lean
/-- Conjugates of `Ξ = lastPathPeriod Ψ y` for the trivial twist. Let `Ψ` be a path datum on the
last path and `y` a pair of forms fixed by the levels at the outer ends of the two halves, whose
values as algebraic forms have `σ`-conjugates of squared norm at most `B false` and `B true`. Then
`‖σ Ξ‖` is at most `exp (x ^ 200 * b ^ 2) * √(B false) * √(B true)`, with `x = D.x` the length of
the prime sum and `b = D.b` the weight at the `b`-places. -/
lemma New.Data.norm_lastPathPeriod_le {Ψ : EdgeTuple (1 : D.MFoldTwist) → ℂ}
    {y : ∀ z : Bool, D.GridForm z 0 D.m}
    (hΨ : IsPathDatum (lastPathBound (1 : D.MFoldTwist)) (TwoGridPath.last D.m).edges Ψ)
    (hy : D.FixedByOuterLevels 1 y) (σ : ℂ ≃+* ℂ) {B : Bool → ℝ}
    (hB : ∀ (z : Bool) (g : Gf D.E (D.LastPathIndex z 0)),
      weylNormSq (σ ∘ (D.lastPathToAlgForm z (y z)).val g) ≤ B z) :
    ‖σ (lastPathPeriod Ψ y)‖ ≤ exp (D.x ^ 200 * D.b ^ 2) * √(B false) * √(B true) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:324-388 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=54 body_sha256=a14506b524353a48c6d77f34d310df09b3d5e1d274e42c7b7d1417e62a219cc5]

lemma New.Data.exists_integral_lowerChainUpTo_eq_lastPathPeriod — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L392-L428)

lean
/-- There are constants `c ϑ`, path data `Ψ ϑ` on the last path, a number `β` and a restriction map
`r` from `gridLevelForms` onto the forms on `Y₀` of principal level at the chosen places, such that
the index of the level `levelY ϑ m` times the pairing of `y'` with the chain of lifts of `r φ`
equals `β * Ξ / c ϑ`. Here `Ξ` is `lastPathPeriod` of `Ψ ϑ` at the pair `(y', φ)`, the sum over the
tuples `S` of matrices on the last path of `Ψ ϑ S` times the integral of the pairing of the lifts of
`y'` and `φ` along its two halves. `HasAbsUpToNormPower c f` says that `‖c ϑ‖²` is
`C * ϑ.normQ ^ k * (f ϑ) ^ 2`, with `C` and `k` independent of `ϑ` and `ϑ.normQ` the product of the
norms of the places in the set `Q` of `ϑ`, and `f` is the product over the `m ^ 2` turns of
`turnRatio i j`, a product of ratios of Hecke values at the twist `ϑ`. -/
lemma New.Data.exists_integral_lowerChainUpTo_eq_lastPathPeriod : ∃ c : D.MFoldTwist → ℂˣ,
    D.HasAbsUpToNormPower (fun ϑ : D.MFoldTwist ↦ c ϑ)
      (∏ i ∈ range D.m, ∏ j ∈ range D.m, D.turnRatio i j) ∧
    ∃ Ψ : ∀ ϑ : D.MFoldTwist, EdgeTuple ϑ → ℂ,
      (∀ ϑ : D.MFoldTwist, IsPathDatum (lastPathBound ϑ) (TwoGridPath.last D.m).edges (Ψ ϑ)) ∧
      ∃ (β : ℂ) (r : D.gridLevelForms D.m →ₗ[ℂ] D.principalForms (D.spaceY 0)),
        r.range = ⊤ ∧
        ∀ (ϑ : D.MFoldTwist) (y' : D.GridForm false 0 D.m) (φ : D.gridLevelForms D.m),
          stdLevelIndex (D.levelY ϑ D.m) *
              ∫ x : New.G D.E (D.signsY D.m),
                y' x * D.lowerChainUpTo ϑ D.m (r φ) x ∂(D.spaceY D.m).quotMeasure =
            β * (lastPathPeriod (Ψ ϑ) (fun z : Bool ↦ z.rec y' φ.val) / c ϑ) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:392-428 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=17 body_sha256=752d2bfd52ed40657826d23f4afe60f1358a46692a52c9d373a494add0622229]

abbrev New.Data.DualVector — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L432-L433)

lean
/-- The space of values of the algebraic forms on `Y_m` of the dual weight. -/
abbrev New.Data.DualVector : Type := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:432-433 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=d063f41a8dc6ccccadc6120dfd700dd04a01e42b9edc1ab7c2c282212f1382fc]

def New.Data.dualPairing — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L435-L440)

lean
/-- The integer matrix of the invariant pairing of the dual weight on `Y_m`, that of the conjugate
forms, with the weight on `Y_m`. -/
def New.Data.dualPairing : Matrix (WeylIndex (D.Y D.m) (D.lastPathColumns false))
    (WeylIndex (D.Y D.m) D.columnsY) ℤ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:435-440 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=c154928052b5adb5b84c37dea7a40314f7c231990242037d2ceb1046410d51ac]

lemma New.Data.isDualPairing_dualPairing — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L442-L448)

lean
/-- The matrix `dualPairing` is a duality between the weight `(columnsY, lastEntry m)` on `Y_m` and
its dual weight `(lastPathColumns false, lastPathDetExp false 0)` (columns of the diagram, exponent
of the determinant), normalised at the highest vector of the parameter `paramY m` of `Y_m`. -/
lemma New.Data.isDualPairing_dualPairing : IsDualPairing D.columnsY (D.lastPathColumns false)
    (D.lastEntry D.m) (D.lastPathDetExp false 0) (D.paramY D.m) D.dualPairing := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:442-448 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=5d1f43791697f588a1dfb84130237b2f404d2e565035718e738003a318d2ffb4]

abbrev New.Data.dualHook — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L450-L452)

lean
/-- The hook number of the dual of the weight on `Y_m`: the square norm of the highest weight
polynomial for the pairing by differentiation, a positive integer. -/
abbrev New.Data.dualHook : ℤ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:450-452 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=c94d978687a869102c07599990c591dedaa43f74ac906a2ef50c29455bc4bb91]

lemma New.Data.dualHook_mul_exp_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L454-L462)

lean
/-- The product of the hook number of the dual weight, `exp (x ^ 99 * b ^ 2)` and
`exp (x ^ 200 * b ^ 2)` is at most `exp (x ^ 201 * b ^ 2)`. -/
lemma New.Data.dualHook_mul_exp_le :
    D.dualHook * exp (D.x ^ 99 * D.b ^ 2) * exp (D.x ^ 200 * D.b ^ 2) ≤
      exp (D.x ^ 201 * D.b ^ 2) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:454-462 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=5 body_sha256=c3f5ecb65972ef24702252813f18ea058743de078198fafc7a6fb01da8047e28]

lemma New.Data.mem_embValRing_of_dualPairing_eq_dualHook_mul — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L464-L480)

lean
/-- Let `ζ` be a vector of the weight on `Y_m`. Suppose that its pairing by `dualPairing` with every
integer vector `w` of the dual weight is `D.dualHook` times an element of `embValRing`. Then every
coordinate of `ζ` is `p`-integral. -/
lemma New.Data.mem_embValRing_of_dualPairing_eq_dualHook_mul {p : ℕ} [Fact p.Prime] [PadicPlace p]
    {ζ : WeylIndex (D.Y D.m) D.columnsY → ℂ}
    (hζ : ∀ w : WeylIndex (D.Y D.m) (D.lastPathColumns false) → ℤ, ∃ a ∈ embValRing,
      (fun k : WeylIndex (D.Y D.m) (D.lastPathColumns false) ↦ (w k : ℂ)) ⬝ᵥ
        D.dualPairing.map (↑) *ᵥ ζ = D.dualHook * a)
    (i : WeylIndex (D.Y D.m) D.columnsY) : ζ i ∈ embValRing := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:464-480 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=9 body_sha256=a9fa634747aaf4c19a45a8dc4891686c026148cc31e47a3251c95817af468ce5]

lemma New.Data.weylNormSq_le_of_dualPairing — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L483-L507)

lean
/-- Let `σ` be an automorphism of `ℂ`, `ζ` a vector of the weight on `Y_m` and `K ≥ 0`. Suppose that
for each `v : D.DualVector`, the `σ`-conjugate of the pairing `v ⬝ᵥ dualPairing *ᵥ ζ` has absolute
value at most `K * √(weylNormSq (σ ∘ v))`. Then `weylNormSq (σ ∘ ζ) ≤ K ^ 2`. -/
lemma New.Data.weylNormSq_le_of_dualPairing (σ : ℂ ≃+* ℂ) {ζ : WeylIndex (D.Y D.m) D.columnsY → ℂ} {K : ℝ}
    (hK : 0 ≤ K)
    (hζ : ∀ v : D.DualVector,
      ‖σ (v ⬝ᵥ D.dualPairing.map (↑) *ᵥ ζ)‖ ≤ K * √(weylNormSq (σ ∘ v))) :
    weylNormSq (σ ∘ ζ) ≤ K ^ 2 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:483-507 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=18 body_sha256=e5febcf11c533421aa665b4aaedc2387024d2a19d72bc72a78a8cb2c88a08a5a]

def New.Data.lastPathDelta — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L513-L518)

lean
/-- The algebraic form `δ_x(v)` of the dual weight on `Y_m`, of level `levelY ϑ m`, supported on the
class of `x`. -/
def New.Data.lastPathDelta :
    levelSpace (algFormRep (D.lastPathColumns false) (D.lastPathDetExp false 0)) (D.levelY ϑ D.m) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:513-518 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=c3ddc9da5853e574330f62bdbe3f3341123d8f03135e3fd055e0c788cc6fb8e9]

def New.Data.lastPathConjDelta — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L520-L522)

lean
/-- The form `δ_x(v)` as a conjugate form on `Y_m`. -/
def New.Data.lastPathConjDelta : D.GridForm false 0 D.m := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:520-522 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=6bf5f637cc822427856e2e13f4856a021032c9807db85028f87e17f54bb05e86]

lemma New.Data.lastPathToAlgForm_lastPathConjDelta — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L524-L526)

lean
lemma New.Data.lastPathToAlgForm_lastPathConjDelta :
    D.lastPathToAlgForm false (lastPathConjDelta ϑ x v) = (lastPathDelta ϑ x v).val := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:524-526 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=1 body_sha256=6549ac19b31ded19571eb32f29d62266344ff880a30d49d0618db8dec1cf5e6b]

lemma New.Data.fixedByOuterLevels_lastPathConjDelta — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L528-L553)

lean
/-- Let `ϑ` be an `m`-fold twist, `x` a finite point of `Y_m`, `v` a vector of the dual weight,
`δ = lastPathConjDelta ϑ x v` the delta form on `Y_m` with value `v` on the class of `x`, and `φ` a
form in `gridLevelForms`. Then the pair `(δ, φ)` satisfies `FixedByOuterLevels ϑ`: as algebraic
forms, `δ` is fixed by the integral points of `Y_m` congruent to `1` modulo `gridModulus ϑ`, and `φ`
by the level `lastPathLevel ϑ true 0` of `Ỹ^m_0`, the integral points congruent to `1` modulo the
part of that modulus that does not depend on `ϑ`. -/
lemma New.Data.fixedByOuterLevels_lastPathConjDelta (φ : D.gridLevelForms D.m) :
    FixedByOuterLevels ϑ fun z : Bool ↦ z.rec (lastPathConjDelta ϑ x v) φ.val := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:528-553 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=19 body_sha256=d254ef8ff427f07a253b3a3096dbf7d50345cfaaf785ae4161a1631b6d9830bc]

lemma New.Data.integral_lastPathConjDelta_mul — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L557-L607)

lean
/-- Pairing with a delta form reads a value. Let `ϑ` be an `m`-fold twist, `x` a finite point of
`Y_m`, `v` a vector of the dual weight and `y` a form on `Y₀`. The index of the level times the
integral of the delta form `δ_x(v) = lastPathConjDelta ϑ x v` against the chain of lifts
`lowerChainUpTo ϑ m y` is the pairing of `v` with the value at `x` of `lowerChain ϑ y`, the same
chain with values in algebraic forms, divided by the dimension of the weight.

The division by the dimension of the weight is the factor in Schur's orthogonality relations for
matrix coefficients of irreducible representations of compact groups, here for the weight on `Y_m`
paired with its dual. -/
lemma New.Data.integral_lastPathConjDelta_mul (y : D.principalForms (D.spaceY 0)) :
    stdLevelIndex (D.levelY ϑ D.m) *
        ∫ g : New.G D.E (D.signsY D.m),
          lastPathConjDelta ϑ x v g * D.lowerChainUpTo ϑ D.m y g ∂(D.spaceY D.m).quotMeasure =
      (v ⬝ᵥ D.dualPairing.map (↑) *ᵥ (D.lowerChain ϑ y).val x) /
        card (WeylIndex (D.Y D.m) D.columnsY) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:557-607 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=37 body_sha256=c5dd7199fa56605f86f57bca20c5cb21efaec0960a03d9a9f888bdb57d850444]

lemma New.Data.weylGauge_lastPathConjDelta_le_one — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L609-L618)

lean
/-- If `x` is integral above `p` and `w` is an integer vector, then the delta form `δ_x(w)` has
`p`-adic gauge at most `1` at every point. -/
lemma New.Data.weylGauge_lastPathConjDelta_le_one {p : ℕ} [Fact p.Prime] [PadicPlace p]
    (hx : x ∈ integralAbove (D.Y D.m) p)
    (w : WeylIndex (D.Y D.m) (D.lastPathColumns false) → ℤ) (g : Gf D.E (D.Y D.m)) :
    weylGauge (D.lastPathColumns false) (D.lastPathDetExp false 0) g
      ((D.lastPathToAlgForm false (lastPathConjDelta ϑ x fun i ↦ w i)).val g) ≤ 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:609-618 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=4 body_sha256=0a04e3fffe2ad450ffceca74318911a1e9b10138f293dbfef6b3fa84e38771b1]

lemma New.Data.weylNormSq_lastPathConjDelta_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L620-L628)

lean
/-- The conjugates of the values of the delta form `δ_x(v)` are no longer than those of `v`, because
the level `levelY ϑ m` is sufficiently small. -/
lemma New.Data.weylNormSq_lastPathConjDelta_le (σ : ℂ ≃+* ℂ) (g : Gf D.E (D.Y D.m)) :
    weylNormSq (σ ∘ (D.lastPathToAlgForm false (lastPathConjDelta ϑ x v)).val g) ≤
      weylNormSq (σ ∘ v) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:620-628 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=5 body_sha256=523e3b1ee72af8185653ad0a2295a015bc5d16e1de812f16524fb6eb3afdae34]

lemma New.Data.exists_dualPairing_eq_mul_lastPathPeriod — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L632-L659)

lean
/-- There are constants `c ϑ`, whose modulus is, up to a constant and a fixed power of the norm
`ϑ.normQ` of the places of `ϑ`, the product over the `m ^ 2` turns of `turnRatio`, functions `Ψ ϑ`
of the matrices on the edges that are path data on the last path, a number `β` and a restriction map
`r` from `gridLevelForms` onto the forms on `Y₀`, such that the pairing of `v` with the value at `x`
of `(c ϑ / c 1) • lowerChain ϑ (r φ)` is `β` times `lastPathPeriod` at the pair `(δ_x(v), φ)`: the
sum over the tuples `S` of `Ψ ϑ S` times the integrated pairing of the lifts of `φ` and of the delta
form `δ_x(v) = lastPathConjDelta ϑ x v` along the two halves of the last path. -/
lemma New.Data.exists_dualPairing_eq_mul_lastPathPeriod : ∃ c : D.MFoldTwist → ℂˣ,
    D.HasAbsUpToNormPower (fun ϑ : D.MFoldTwist ↦ c ϑ)
      (∏ i ∈ range D.m, ∏ j ∈ range D.m, D.turnRatio i j) ∧
    ∃ Ψ : ∀ ϑ : D.MFoldTwist, EdgeTuple ϑ → ℂ,
      (∀ ϑ : D.MFoldTwist, IsPathDatum (lastPathBound ϑ) (TwoGridPath.last D.m).edges (Ψ ϑ)) ∧
      ∃ (β : ℂ) (r : D.gridLevelForms D.m →ₗ[ℂ] D.principalForms (D.spaceY 0)),
        r.range = ⊤ ∧
        ∀ (ϑ : D.MFoldTwist) (φ : D.gridLevelForms D.m) (x : Gf D.E (D.Y D.m))
          (v : D.DualVector),
          v ⬝ᵥ D.dualPairing.map (↑) *ᵥ ((c ϑ / c 1 : ℂ) • D.lowerChain ϑ (r φ)).val x =
            β * lastPathPeriod (Ψ ϑ) fun z : Bool ↦ z.rec (lastPathConjDelta ϑ x v) φ.val := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:632-659 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=11 body_sha256=4cea237c7898a1578297c64f5073b8928f73f65dcd0874f582bec29698e3ccd1]

lemma New.Data.exists_lowerChain_integral_and_weylNormSq_le — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L663-L740)

lean
/-- There are constants `c ϑ` whose modulus is, up to a constant and a fixed power of the norm
`ϑ.normQ` of the places of `ϑ`, the product of the ratios `turnRatio`, a restriction map `r` from
`gridLevelForms` onto the forms on `Y₀` and a number `s ≠ 0` with two properties. (a) If the
algebraic form `lastPathToAlgForm true φ` of `φ` has `p`-integral values at a prime `p` that does
not divide `ϑ.normQ`, then `(c ϑ / c 1) • lowerChainAtLevel ϑ (s • r φ)` is in `integralForms`, the
forms with `p`-integral values. (b) For the trivial twist and `σ` in `Aut(ℂ)`, if the `σ`-conjugates
of the values of that algebraic form have squared norm `weylNormSq` at most `B`, then those of
`lowerChain 1 (s • r φ)` have squared norm at most `exp (2 * x ^ 201 * b ^ 2) * B`. -/
lemma New.Data.exists_lowerChain_integral_and_weylNormSq_le : ∃ c : D.MFoldTwist → ℂˣ,
    D.HasAbsUpToNormPower (fun ϑ : D.MFoldTwist ↦ c ϑ)
      (∏ i ∈ range D.m, ∏ j ∈ range D.m, D.turnRatio i j) ∧
    ∃ (r : D.gridLevelForms D.m →ₗ[ℂ] D.principalForms (D.spaceY 0)) (s : ℂ),
      r.range = ⊤ ∧ s ≠ 0 ∧
      (∀ (ϑ : D.MFoldTwist) (p : ℕ) [Fact p.Prime] (place : PadicPlace p)
          (φ : D.gridLevelForms D.m),
        p.Coprime ϑ.normQ → GaugeLe 1 1 (D.lastPathToAlgForm true φ.val) →
        (c ϑ / c 1 : ℂ) • D.lowerChainAtLevel ϑ (s • r φ) ∈ integralForms (l := p) place) ∧
      ∀ (σ : ℂ ≃+* ℂ) (φ : D.gridLevelForms D.m) (B : ℝ),
        (∀ g : Gf D.E (D.LastPathIndex true 0),
          weylNormSq (σ ∘ (D.lastPathToAlgForm true φ.val).val g) ≤ B) →
        ∀ g : Gf D.E (D.Y D.m),
          weylNormSq (σ ∘ (D.lowerChain .one (s • r φ)).val g) ≤
            exp (2 * D.x ^ 201 * D.b ^ 2) * B := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:663-740 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=56 body_sha256=71ea9123d9649883557e8d4ae8c3d36ccc7cff9fe471f444e094421a9e40b590]

lemma New.Data.span_isShort_eq_top_gridLevelForms — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L742-L767)

lean
/-- The space `gridLevelForms` of forms of level `J(𝔟)` on `Ỹ^m_0`, the space at the outer end of
the half `true` of the last path, is spanned by the forms `φ` whose algebraic forms
`lastPathToAlgForm true φ` are short: their values are integral at every prime and all conjugates of
the values have squared norm at most `exp (x ^ 99 * b ^ 2)`, with `x = D.x` the length of the prime
sum and `b = D.b` the weight at the `b`-places. -/
lemma New.Data.span_isShort_eq_top_gridLevelForms : span ℂ {φ : D.gridLevelForms D.m |
    IsShort (exp (D.x ^ 99 * D.b ^ 2)) (D.lastPathToAlgForm true φ.val)} = ⊤ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:742-767 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=20 body_sha256=758f4938c28046fc4a27b8751fad165ecccaa65adc15fe8565bfdcad62c6e4ec]

lemma New.Data.exists_span_short_lifts_eq_top — Upstream source (src/New/Determinant/AuxiliaryForms/SpanningForms.lean L769-L796)

lean
/-- The space of forms on `Y₀` of principal level at the chosen places is spanned by auxiliary forms
with integral and small lifts. There are constants `c ϑ`, whose modulus is, up to a constant and a
fixed power of the norm `ϑ.normQ` of the places of `ϑ`, the product of the ratios `turnRatio`, such
that this space is spanned by the forms `y` with two properties: for all twists `ϑ`,
`(c ϑ / c 1) • lowerChainAtLevel ϑ y` has values integral at every prime not dividing `ϑ.normQ`, and
all conjugates of the values of `lowerChain 1 y`, the chain of lifts for the trivial twist, have
squared norm `weylNormSq` at most `exp (x ^ 202 * b ^ 2)`, with `x = D.x` the length of the prime
sum and `b = D.b` the weight at the `b`-places. -/
lemma New.Data.exists_span_short_lifts_eq_top : ∃ c : D.MFoldTwist → ℂˣ,
    D.HasAbsUpToNormPower (fun ϑ : D.MFoldTwist ↦ c ϑ)
      (∏ i ∈ range D.m, ∏ j ∈ range D.m, D.turnRatio i j) ∧
    span ℂ {y : D.principalForms (D.spaceY 0) |
      (∀ (ϑ : D.MFoldTwist) (l : ℕ) [Fact l.Prime] (place : PadicPlace l), l.Coprime ϑ.normQ →
        (c ϑ / c 1 : ℂ) • D.lowerChainAtLevel ϑ y ∈ integralForms (l := l) place) ∧
      ∀ (σ : ℂ ≃+* ℂ) (g : Gf D.E (D.Y D.m)),
        weylNormSq (σ ∘ (D.lowerChain .one y).val g) ≤ exp (D.x ^ 202 * D.b ^ 2)} = ⊤ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Determinant/AuxiliaryForms/SpanningForms.lean:769-796 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=13 body_sha256=aa3c4704a1b8bf9cf313d228435d2c3bbfa591976d5cdc3253304459ac766ca3]

Page Glossary ​

theta square law
Commutation of theta lifts around a four-corner square (U_1, U_2, A, A'): summing down-then-up over matched matrix data equals (kappa / c) times summing up-then-down, with |c|^2 = C * L_*(t) != 0 and kappa independent of twist.
regular twist family
A prime-by-prime family of m-fold anticyclotomic twists theta(iota) with modulus coprime to l, inverse L-value ratios of height at most x_1, and lift/projection denominators summing within f*a*(log b)^3 / (m*k).
Gram determinant
The determinant of the matrix of pairwise inner products of a family of vectors, measuring the squared volume of the parallelotope they span and controlled by Hadamard's and Fischer's inequalities.
Rallis inner product formula
Relating the squared norm (and Gram determinant) of a theta lift or m-step chain of lifts to spherical Hecke operators and single-lift determinants—factoring Z(theta)/Z(1) across m lifts up to quotient L-value ratios.
Hecke operator
An averaging operator that sums values of an automorphic form over neighboring sublattices—indexed by cosets of a parahoric subgroup—which Stage 03 scales by powers of a prime to eliminate collision losses in the composite theta lift.
trace comparison
Matching traces of spherical Hecke operators between an indefinite unitary group and its definite inner form via a cuspidal local test function—proving equal eigensystem multiplicities, Rallis determinant equality, and the target-dimension bound.
Hecke L-value ratio
The ratio |L^S(z, (nu * theta^s)^-1)| / |L^S(z, nu^-1)| of twisted to untwisted partial Hecke L-values at a critical pair (nu, z), tracking how Siegel–Weil exchange constants scale under twisting across chain quotients and grid turns.
arithmetic height
A logarithmic measure combining ordinary archimedean size with prime-by-prime p-adic divisibility, locked together by the product formula so a nonzero algebraic quantity cannot be simultaneously small at every place.
auxiliary spanning form
A target form whose m-step lifts stay p-integral (after a shared twist scalar) and bounded in archimedean norm by exp(2*x_1^2*b^2), completing an almost-spanning family to a full basis of Y_0 at total cost at most d*b.
prime number
A whole number greater than 1 whose only positive whole-number divisors are 1 and itself; every integer above 1 factors uniquely into a product of them.
seesaw duality
A dual-pair adjunction identity that trades an iterated lower-chain theta lift of a Poincaré series for a nonzero twist-independent scalar times the restriction of an upper-chain composite theta lift.
Weyl gauge
The p-adic coordinate norm of an algebraic modular form measured in the g-twisted Weyl lattice, paired with Galois-conjugate archimedean bounds to define B-short spanning sets and ramified source forms.