Skip to content

Galois Main Summands and the Anticyclotomic Selmer Twisting Theorem ​

This page explains the two representation-theoretic and twisting landmarks of Stage 07: src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean (07_congruences/rows_from_eigensystems, 15 declarations, 0 stub truncations) — which extracts fixed, twist-independent Galois main summands from Hecke eigensystems of theta lifts — and src/New/Congruences/Selmer/TwistingTheorem.lean (07_congruences/twisting_theorem, 11 declarations, 1 let-type stub truncation documented verbatim below) — which chooses one m-fold anticyclotomic twist τ simultaneously keeping auxiliary ramification, divisible crystalline Selmer lengths, and ramified Hecke L-value ratio valuations inside twistError ℓ D. Return to the Stage 07 Overview, revisit Crystalline Lifting, Kummer Charts, and Local Dual Defect, or proceed to First-Order Ribet Denominator Bounds and Existence of Regular Twist Families.

Level 1 · First-Principles

Level 1 — First-Principles ​

Before Stage 07 can clear congruence denominators by Ribet's method, it must solve two global problems at each primeprime number ℓ and embedding ι:C≃Q―ℓ:

  1. Identify the finitely many twist-independent Galois representations whose Selmer groups govern all congruences of theta lifts across every twist ϑ.
  2. Find a single m-fold twistregular twist family τ whose first m powers ξ=τj (1≤j≤m) simultaneously make all of those Selmer groups short and keep all ramified partial Hecke L-value ratiosHecke L-value ratio barely divisible by ℓ.

Pipeline diagram showing how good Hecke eigenforms on W_m (rank r) and rank-1 critical pairs produce finitely many twist-independent Galois blocks R_a and R_{1,b}, paired with Stage 06 integral twist measures from three_exchanges via ClassSums inside exists_mFoldTwist_hasDivisibleSelmerLengthLe to choose one m-fold twist tau bounded by twistError

Part 1: Extracting twist-independent Galois blocks (RowsFromEigensystems.lean) ​

Take any good Hecke eigenform on the rank-r space Wm (inside the image of the good finite-field idempotentcentral idempotent e0) with split-place Hecke eigenvaluesHecke operator b(w,i), and consider its theta lifttheta correspondence y on the rank-(r+t) target space Vj twisted by an arbitrary tame character ϑ. Because the unramified theta correspondence multiplies the source Hecke polynomial by a q-Pochhammer factor ∏e=0t−1(1−qeαX), comparing linear terms (apply_one_eq_of_heckePolyEval_eq, neg_coeff_eq_of_hasLiftHeckePolynomial) and passing to Frobenius elements along mostFrobenii D.E proves the exact lift trace decompositionGalois main summand (eventually_trace_frob_eq_of_hasLiftHeckePolynomial):

−normalizingAvatar(V,φ)ιℓ(Hw.coeff(n−1))=ψϑ(φ)⋅tr(T(φ))+∑e=0t−1χcyc−e(φ).

Here ψϑ is the ℓ-adic Galois avatar of ϑ−1, ∑e=0t−1χcyc−e is the inverse-cyclotomic string, and T is the Galois main summand (IsMainSummand O b T)—completely independent of ϑ.

RowsFromEigensystems.lean also verifies that the Hodge–Tate jumps of both rank-r descent pairs and rank-1 main pairs satisfy the exact separation constraints IsMainSummandWeights required by CrystallineDefect.lean:

  • Rank-r descent pairs (isMainSummandWeights_descentPair): For each 1≤j≤m, the r jumps uq=⌊t/2⌋−ε(λq+wj) split into k−1 high jumps (|εuq+wj|≤t) and exactly m low jumps (Δ/4≤|uq|≤2mΔ).
  • Rank-1 main pairs (isMainSummandWeights_mainPair): For each main pair p=(ν,z) (m<z≤r, wj+r−t≤c≤wj), the single jump z−1−εc lies within t of −εwj and obeys IsMainSummandWeights D 1 (2 * p.z - 1).

Attaching a conjugate self-dual Galois representation R to each good eigensystem on Wm (under an admissible lift setting IsLiftSetting), twisting by the algebraic character μ−1(x/x¯)|x|a (isMainSummandLike_twistByChar), and verifying Frobenius trace limits (exists_isMainSummand_of_isRepOfType) proves New.Selmer.exists_isMainSummand_descentPair. Since D.goodForms (D.spaceW D.m) is finite-dimensional, only finitely many rank-r main summands occur across all good lifts.

Part 2: Simultaneous m-fold Selmer and L-value twisting (TwistingTheorem.lean) ​

Next, Selmer/TwistingTheorem.lean feeds finitely many main summands Ri into anticyclotomic Selmer twistinganticyclotomic Selmer twisting via two paired inputs:

  1. Selmer data (exists_selmerData_isTorsionLevel): Choosing a chosen place w0∤ℓ above M=p0p1 and its tame inertia generator g0, every Ri admits a Selmer datum Ti over a large coefficient ring O, unramified outside ℓp0p1, with crystalline local conditions above ℓ, normalized error β(Ti)≤c=(4f+3)rvℓ(D.chosenGroupOrder), and residue field large enough to satisfy IsTorsionLevel T (c + 2).
  2. Stickelberger systems from Stage 06 (Selmer/ClassSums.lean + Selmer/LValueSystems.lean): Importing Stage 06 — Three Exchanges and Gluing (06_one_lift/three_exchanges) via Selmer/ClassSums.lean, Stage 07 constructs integral twist measures (IsTwistMeasure) interpolating every ramified pair's L-value ratio p.ratio(ξ,±1) into a Stickelberger system of group-ring elements.

Invoking the horizontal twisting theorem (Selmer/GeneralTheorem.lean::exists_anticyclotomic_twist) with tolerance 2−ℓ proves New.Selmer.exists_mFoldTwist_hasDivisibleSelmerLengthLe: there exists one m-fold twist τ:D.MFoldTwist whose powers ξ=τj (1≤j≤m) simultaneously satisfy:

  • Auxiliary ramification (IsSmallTwist.isAuxTwist): Q=ξ.Q has prime-norm places disjoint from Q¯ and badPlaces D ℓ (places dividing ℓp0p1N), ψ=ξ.invAvatar is anticyclotomic and trivial above ℓ, and ∑w∈Qvℓ(ψ(γw)−1)≤eℓ′;
  • Short divisible crystalline Selmer groups (HasDivisibleSelmerLengthLe): Every ψRi has a lattice with an inertial scalar element γ whose crystalline Selmer group with coefficients in Frac(O)/O (unramified outside ℓp0p1QQ¯) has normalized length at most eℓ′;
  • Small L-value ratio valuations: For every ramified pair p and sign s=±1, vℓ(ιℓ(p.ratio(ξ,s)))≤eℓ′ (so by norm_inv_le_exp_of_ellVal_le, its inverse has norm ≤ℓeℓ′, contributing directly to global arithmetic heightarithmetic height ≤x1).

Here the explicit twist error is

eℓ′=twistError(ℓ,D)=(4D.f+3)D.rvℓ(D.chosenGroupOrder)+2−ℓ.

Notice an important detail in that formula: D.chosenGroupOrder is the product over the chosen places above p0,p1 of |GLr⋅t(kw)| (rank r⋅t, not |GLr(kw)|). Because D.chosenGroupOrder is a fixed integer depending only on D, summing eℓ′log⁡ℓ across all primes stays bounded by D.x999 (isNegligible_twistError in FitTwistsExist.lean).

Where this analogy breaks ​

Thinking of RowsFromEigensystems.lean and TwistingTheorem.lean as "take one Galois representation, twist it once, and shrink its Selmer group" omits two crucial constraints. First, a single m-fold twist τ must work simultaneously for all m powers ξ=τ1,…,τm, for all finitely many main summands Ri (both rank r and rank 1), and for all ramified critical pairs p with both signs s=±1. Second, SelmerDatum.TwistedLengthLe.hasDivisibleSelmerLengthLe only works because the auxiliary twist character ψ is trivial on every decomposition group above ℓ (mapRel_crysRelations_subset) and on the tame inertia generator T.γ (SelmerDatum.apply_γ_eq_one), preserving crystalline conditions unchanged under twisting.

Level 2 · Undergrad Bridge

Level 2 — Undergrad Bridge ​

1. All 15 declarations of RowsFromEigensystems.lean (0 truncations) ​

GroupDeclarations (Count)Mathematical Role
Jump-window checkscmSign_star, abs_descentPair_weight_add_liftWeight_le, le_natAbs_descentPair_jump_and_le, countP_low_weights_descentPair, isMainSummandWeights_descentPair, abs_mainPair_weight_add_liftWeight_le, isMainSummandWeights_mainPair (7)Verifies IsMainSummandWeights D D.r D.t for the j-th descent pair (k−1 high jumps within t of −εwj, exactly m low jumps in [Δ/4,2mΔ]) and IsMainSummandWeights D 1 (2 * p.z - 1) for every main pair p.
Hecke-polynomial & trace factorizationapply_one_eq_of_heckePolyEval_eq, neg_coeff_eq_of_hasLiftHeckePolynomial, eventually_trace_frob_eq_of_hasLiftHeckePolynomial (3)Converts HasLiftHeckePolynomial into the linear-coefficient identity −Hw.coeff(n−1)=qt(ν/ν′)b(w,1)+(∑i<tqi)ν and then into the ℓ-adic Frobenius trace identity along mostFrobenii D.E.
Main summand constructionIsRepOfType.isMainSummandLike_twistByChar, exists_isMainSummand_of_isRepOfType, map_jumps_sub_eq_map_targetParameter, Data.isEigenform_of_hasHeckePolyAt, exists_isMainSummand_descentPair (5)Twists an attached IsRepOfType representation by $\mu^{-1}(x/\bar x)

2. All 11 declarations of TwistingTheorem.lean (1 truncation) ​

  1. Valuation & crystalline pushforward (5 decls): norm_inv_le_exp_of_ellVal_le (vℓ(ιℓx)≤c⇒∥ιℓx−1∥≤exp⁡(clog⁡ℓ)), mapRel_crysRelations_subset, IsSmallTwist.isAuxTwist, divisibleSelmerLength_le_divisibleLength, SelmerDatum.apply_γ_eq_one.
  2. Selmer length transfer & error bounds (4 decls): SelmerDatum.TwistedLengthLe.hasDivisibleSelmerLengthLe, four_mul_ellVal_levelPrime_sub_one_add_le_twistError (4vℓ(pi−1)+2−ℓ≤twistError ℓ D), invAvatar_pow, tamePart_ne_one_of_invAvatar_ne_one.
  3. Packaging & horizontal twisting theorem (2 decls): exists_selmerData_isTorsionLevel (builds SelmerDatum family over O with IsTorsionLevel T (c + 2)) and exists_mFoldTwist_hasDivisibleSelmerLengthLe (combining Selmer/GeneralTheorem.lean with Selmer/LValueSystems.lean / Selmer/ClassSums.lean imported from 06_one_lift/three_exchanges).
Level 3 · Formal Lean Contract

Level 3 — Formal Lean Contract ​

skeleton/07_congruences/rows_from_eigensystems.lean (15 declarations, 0 stub truncations) and skeleton/07_congruences/twisting_theorem.lean (11 declarations, 1 let-type stub truncation) mirror src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean and src/New/Congruences/Selmer/TwistingTheorem.lean at pinned upstream commit 41c2716658c42ba08eb0648994a2efe83082a95c. All 15 declarations in rows_from_eigensystems.lean extract completely untruncated.

Stub-Truncation Disclosure (1 Truncation in twisting_theorem.lean; 0 in rows_from_eigensystems.lean) ​

In skeleton/07_congruences/twisting_theorem.lean, 1 declaration — New.Selmer.exists_mFoldTwist_hasDivisibleSelmerLengthLe (decl starts L172, truncated at let ξ : D.Twist := on L177) — is cut at its let ... := return-type binding by rh-extract's depth-0 := splitter. Its exact untruncated signature from pinned upstream src/New/Congruences/Selmer/TwistingTheorem.lean:373–386 is:

lean
-- Verbatim from upstream src/New/Congruences/Selmer/TwistingTheorem.lean:373-386
theorem exists_mFoldTwist_hasDivisibleSelmerLengthLe {P : Parameters} (D : Data P) (ℓ : ℕ)
    [ThePrime ℓ] (ι : PadicIso ℓ) {I : Type} [Finite I] {r : I → Type} [∀ i : I, Fintype (r i)]
    [∀ i : I, DecidableEq (r i)] {R : ∀ i : I, GalRep ℓ D.E (r i)}
    (hR : ∀ i : I, ∃ (t : ℕ) (J : (D.E →+* ℂ) → Multiset ℤ), IsMainSummandLike D t J (R i)) :
    ∃ τ : D.MFoldTwist, ∀ j : D.LiftIndex,
      let ξ : D.Twist := τ.powTwist j
      -- The ramification is auxiliary and small.
      IsAuxTwist (badPlaces D ℓ) ξ.Q ξ.invAvatar (twistError ℓ D) ∧
      -- The Selmer groups of the twisted representations are short.
      (∀ i : I, ∃ γ : AbsGal D,
        HasDivisibleSelmerLengthLe ξ.invAvatar (R i) ξ.Q γ (twistError ℓ D)) ∧
      -- The ratios of `L`-values have small valuation.
      ∀ (p : D.CriticalPair) (s : ℤˣ), p.IsRamified →
        ellVal (ιℓ (p.ratio ξ s)) ≤ twistError ℓ D

All 10 remaining declarations in twisting_theorem.lean and all 15 declarations in rows_from_eigensystems.lean extract completely untruncated.

Headline Untruncated Signatures (rows_from_eigensystems.lean) ​

lean
-- skeleton/07_congruences/rows_from_eigensystems.lean (upstream RowsFromEigensystems.lean:476-561)
theorem New.Selmer.exists_isMainSummand_descentPair {ℓ : ℕ} [ThePrime ℓ] (ι : PadicIso ℓ)
    {p : FinPlace D.E × ℕ → ℂ}
    (h_ne_bot : D.goodForms (D.spaceW D.m) ⊓ D.eigenPart (D.spaceW D.m) p ≠ ⊥) (j : D.LiftIndex) :
    ∃ T : GalRep ℓ D.E D.RowIndex,
      IsMainSummand (D.descentPair TameChar.one j) (fun (w : FinPlace D.E) (i : ℕ) ↦ p (w, i))
        T
  • 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. Neither RowsFromEigensystems.lean nor TwistingTheorem.lean has been locally compiled, kernel-checked, or statically scanned here.

lemma New.Selmer.cmSign_star — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L64-L68)

lean
/-- The sign `cmSign` of a complex embedding (`1` on the CM type, `-1` off it) changes under complex
conjugation. -/
@[simp]
lemma New.Selmer.cmSign_star (σ : D.E →+* ℂ) : cmSign (E := D.E) (star σ) = -cmSign σ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:64-68 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=2 body_sha256=55de8b8124c2bd11f6cb65a8064f3904781d7d3e98909cf377f010795242e96d]

lemma New.Selmer.abs_descentPair_weight_add_liftWeight_le — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L70-L86)

lean
/-- Let `D` be admissible data (`Data P`) over the CM field `D.E`, with rank `r = D.r`, number of
lifts `m = D.m`, `k = D.k = r + 1 - m` and `t = D.t = 5 r`. At a complex embedding `σ` of `D.E`,
over the infinite place `v`, the `q`-th jump (Hodge–Tate weight) of the `j`-th descent pair is the
integer `u = t / 2 - ε (λ_q + w_j)`. Here `t / 2` is integer division, `ε = cmSign σ` is `1` on the
CM type and `-1` off it, `λ_q = D.targetParameter v q` is the fixed parameter of the rank `r` group
and `w_j = D.liftWeight j v` is minus the weight of the character of the `j`-th lift. For
`q + 1 < k` the jump is high: `|ε u + w_j| ≤ t`. -/
lemma New.Selmer.abs_descentPair_weight_add_liftWeight_le (j : ℕ) (σ : D.E →+* ℂ) {q : ℕ} (hq : q + 1 < D.k)
    {u : ℤ}
    (hu : u = D.t / 2 -
      cmSign σ * (D.targetParameter (InfinitePlace.mk σ) q + D.liftWeight j (InfinitePlace.mk σ))) :
    |cmSign σ * u + D.liftWeight j (InfinitePlace.mk σ)| ≤ D.t := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:70-86 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=6 body_sha256=edece842e1dd65e7d3794c7707d4d12cbd93bd536e473fb2ed79fe1587412a16]

lemma New.Selmer.le_natAbs_descentPair_jump_and_le — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L88-L118)

lean
/-- Let `D` be admissible data over the CM field `D.E`, with `r = D.r`, `m = D.m`, `k = D.k` and
`Δ = D.gap`. Let `1 ≤ j ≤ m` (`D.LiftIndex`). At a complex embedding `σ` over the infinite place
`v`, the `q`-th jump (Hodge–Tate weight) of the `j`-th descent pair is the integer
`u = t / 2 - ε (λ_q + w_j)`, with `t = D.t`, `ε = cmSign σ = ±1` (`1` on the CM type),
`λ_q = D.targetParameter v q` and `w_j = D.liftWeight j v`, minus the weight of the character of
the `j`-th lift. For `k ≤ q + 1 ≤ r` the jump is low: `Δ / 4 ≤ |u| ≤ 2 m Δ`. -/
lemma New.Selmer.le_natAbs_descentPair_jump_and_le {j : ℕ} (hj : j ∈ D.LiftIndex) (σ : D.E →+* ℂ) {q : ℕ}
    (hq_ge : D.k ≤ q + 1) (hq_lt : q < D.r) {u : ℤ}
    (hu : u = D.t / 2 -
      cmSign σ * (D.targetParameter (InfinitePlace.mk σ) q + D.liftWeight j (InfinitePlace.mk σ))) :
    D.gap ≤ 4 * u.natAbs ∧ u.natAbs ≤ 2 * D.m * D.gap := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:88-118 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=21 body_sha256=7d5d8e2418b4555f4faf15dcfcb0b13a6f6c15afe1092f1bafaf9eb965b38fab]

lemma New.Selmer.countP_low_weights_descentPair — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L120-L144)

lean
/-- Let `D` be admissible data, `1 ≤ j ≤ m = D.m` and `σ` a complex embedding of the CM field `D.E`
over the infinite place `v`. The jumps (Hodge–Tate weights) of the `j`-th descent pair at `σ` are
the `r = D.r` integers `t / 2 - ε (λ_q + w_j)`, `q < r`, where `t = D.t`, `ε = cmSign σ = ±1`,
`λ_q = D.targetParameter v q` and `w_j = D.liftWeight j v` is minus the weight of the character of
the `j`-th lift. If `2 m Δ ≤ B` and `B + t < w_j`, with `Δ = D.gap`, then exactly `m` of them have
modulus at most `B`. -/
lemma New.Selmer.countP_low_weights_descentPair {j : ℕ} (hj : j ∈ D.LiftIndex) (σ : D.E →+* ℂ) {B : ℕ}
    (hB_ge : 2 * D.m * D.gap ≤ B) (hB_lt : B + D.t < D.liftWeight j (InfinitePlace.mk σ)) :
    countP (fun u : ℤ ↦ u.natAbs ≤ B) ((Multiset.range D.r).map fun q : ℕ ↦ (D.t / 2 -
      cmSign σ * (D.targetParameter (InfinitePlace.mk σ) q + D.liftWeight j (InfinitePlace.mk σ)) :
        ℤ)) = D.m := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:120-144 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=15 body_sha256=7bed125e72f73643b4c882aa9f78e7b794063709e68415a210aed4f0332fff04]

lemma New.Selmer.isMainSummandWeights_descentPair — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L146-L174)

lean
/-- Let `1 ≤ j ≤ m` (`D.LiftIndex`, `m = D.m`). At a complex embedding `σ`, over the infinite place
`v`, take as jumps (Hodge–Tate weights) the `r = D.r` integers `t / 2 - ε (λ_q + w_j)`, `q < r`, of
the `j`-th descent pair. Here `t = D.t`, `ε = cmSign σ` is `1` on the CM type and `-1` off it,
`λ_q = D.targetParameter v q` is the fixed parameter of the rank `r` group, and
`w_j = D.liftWeight j v` is minus the weight of the character of the lift. These jumps satisfy
`IsMainSummandWeights D r t`. -/
lemma New.Selmer.isMainSummandWeights_descentPair {j : ℕ} (hj : j ∈ D.LiftIndex) :
    IsMainSummandWeights D D.r D.t fun σ : D.E →+* ℂ ↦ (Multiset.range D.r).map fun q : ℕ ↦
      D.t / 2 -
      cmSign σ * (D.targetParameter (InfinitePlace.mk σ) q + D.liftWeight j
        (InfinitePlace.mk σ)) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:146-174 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=19 body_sha256=22cd7dbb4d02d3e2e87e292d2293e3412fad06ae6b95d4c5d739f025d751088f]

lemma New.Selmer.abs_mainPair_weight_add_liftWeight_le — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L176-L194)

lean
/-- Let `p` be a critical pair of the data `D`: an integer `z = p.z` and a character of `U(1)` of
weight `-c`, with `c = p.negWeight`. Let it be a main pair for `j` (`IsMainPair`): in particular
`m < z ≤ r` and `w_j + r - t ≤ c ≤ w_j`, where `m = D.m`, `r = D.r`, `t = D.t = 5 r` and
`w_j = D.liftWeight j` is minus the weight of the character of the `j`-th lift. At a complex
embedding `σ` over the infinite place `v`, with `ε = cmSign σ = ±1`, the jump (Hodge–Tate weight)
of `p` is `u = z - 1 - ε c v`. It is high: `|ε u + w_j v| ≤ t`. -/
lemma New.Selmer.abs_mainPair_weight_add_liftWeight_le {p : D.CriticalPair} {j : ℕ} (hp : p.IsMainPair j)
    (σ : D.E →+* ℂ) {u : ℤ} (hu : u = p.z - 1 - (cmSign σ : ℤ) * p.negWeight (InfinitePlace.mk σ)) :
    |cmSign σ * u + D.liftWeight j (InfinitePlace.mk σ)| ≤ D.t := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:176-194 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=11 body_sha256=af9f0d07e785a0ca486224210ea2c5733c63e641bfc401c7f18b8061d61640e5]

lemma New.Selmer.isMainSummandWeights_mainPair — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L196-L226)

lean
/-- Let `p` be a main pair for `j` (`IsMainPair`): an integer `z = p.z` and a character of `U(1)` of
weight `-c`, `c = p.negWeight`, with in particular `m < z ≤ r` and `w_j + r - t ≤ c ≤ w_j`, where
`w_j = D.liftWeight j` is minus the weight of the character of the `j`-th lift. At a complex
embedding `σ` over the infinite place `v`, take the single jump (Hodge–Tate weight)
`z - 1 - ε c v`, with `ε = cmSign σ` equal to `1` on the CM type and `-1` off it. These jumps
satisfy `IsMainSummandWeights D 1 (2 z - 1)`, the conditions on the jumps of a rank one
representation that is paired with `2 z - 1` consecutive powers of the inverse cyclotomic character:
each is low or within `t` of `-ε w_j`, few are small, and at most one at `σ` and its conjugate is
negative. -/
lemma New.Selmer.isMainSummandWeights_mainPair {p : D.CriticalPair} {j : ℕ} (hp : p.IsMainPair j) :
    IsMainSummandWeights D 1 (2 * p.z - 1) fun σ : D.E →+* ℂ ↦
      {(p.z - 1 - cmSign σ * p.negWeight (InfinitePlace.mk σ) : ℤ)} := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:196-226 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=20 body_sha256=a179e7a9d0337cacdfd02141bb048abdeb5e6a09da4fc84fa9dc5bfe497f5343]

lemma New.Selmer.apply_one_eq_of_heckePolyEval_eq — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L245-L257)

lean
/-- Let `r` and `n` be nonempty. Suppose that, for all `X`, the Hecke polynomial at `w` of rank `n`
with eigenvalues `s` equals `qPochhammer q t (α X) = ∏_{l < t} (1 - q ^ l α X)` times the Hecke
polynomial of rank `r` with eigenvalues `z` at `β X`, where `q` is the norm of `w`. Comparing the
linear terms gives `s 1 = β z 1 + (∑_{i < t} q ^ i) α z 0`. -/
lemma New.Selmer.apply_one_eq_of_heckePolyEval_eq (r_pos : 0 < Fintype.card r) (n_pos : 0 < Fintype.card n)
    {w : FinPlace D.E} {s z : ℕ → ℂ} {t : ℕ} {α β : ℂ} (h_eq : ∀ X : ℂ,
      heckePolyEval n w s X = qPochhammer w.q t (α * X) * heckePolyEval r w z (β * X)) :
    s 1 = β * z 1 + (∑ i ∈ Finset.range t, (w.q : ℂ) ^ i) * α * z 0 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:245-257 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=6 body_sha256=f14d2e10db1b3f044175ec17be198ac7e9870034258132d367845cbedc4f7066]

lemma New.Selmer.IsRepOfType.isMainSummandLike_twistByChar — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L259-L295)

lean
/-- Let `O` be a descent pair over the CM field `D.E` of the data `D`: two spaces of dimensions
`r < n`, a character `μ = O.u1Char` of `U(1)` of weight `O.weight`, and chosen places
`O.chosenPlace i`. Put `t = O.rankDiff = n - r` and assume `r - t = 2 a`. Let `c` give for each
chosen place a polynomial over its residue field, admissible for `O` and the trivial twist
(`IsLiftSetting`). Let `R` be an `r`-dimensional `ℓ`-adic Galois representation of `D.E` that is
conjugate self-dual, unramified off the places that `O` allows (empty extra level), has jumps
(Hodge–Tate weights) `J`, and whose inertia at the chosen places acts through the roots of `c`
(`IsRepOfType`). Lower the jumps at each embedding `σ` by `a - cmSign σ * O.weight v`, with `v` the
place of `σ` and `cmSign σ = ±1`, and suppose that they obey the numerical conditions
`IsMainSummandWeights`. Then `R` twisted by the avatar of `O.hasWeight.inv.toAlgebraic 0 a`, the
algebraic Hecke character `μ⁻¹(x / x̄) |x| ^ a`, is like a main summand (`IsMainSummandLike`) with
the lowered jumps and string length `t`. -/
lemma New.Selmer.IsRepOfType.isMainSummandLike_twistByChar [PadicIso ℓ]
    {c : (i : O.ChosenIndex) → (ResField (O.chosenPlace i))[X]} {J : (D.E →+* ℂ) → Multiset ℤ}
    {R : GalRep ℓ D.E r} (hR : IsRepOfType O (Fintype.card r) J c ∅ R)
    (hO : IsLiftSetting O c 1) {a : ℤ} (ha : (Fintype.card r - O.rankDiff : ℤ) = 2 * a)
    (hJ : IsMainSummandWeights D (Fintype.card r) O.rankDiff fun σ : D.E →+* ℂ ↦
      (J σ).map fun u : ℤ ↦ u - (a - cmSign σ * O.weight (NumberField.InfinitePlace.mk σ))) :
    IsMainSummandLike D O.rankDiff (fun σ : D.E →+* ℂ ↦
        (J σ).map fun u : ℤ ↦ u - (a - cmSign σ * O.weight (NumberField.InfinitePlace.mk σ)))
      (twistByChar (O.hasWeight.inv.toAlgebraic 0 a).avatar R) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:259-295 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=17 body_sha256=b28a960d42ea83616ab2c3232f4b2854bd1cd12cddb79d0e666cc0a42a08a361]

lemma New.Selmer.neg_coeff_eq_of_hasLiftHeckePolynomial — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L297-L327)

lean
/-- Let the nonzero form `y` of the descent pair `V` of ranks `0 < r < n` lift the system `b` of
Hecke eigenvalues, and let `H` be its Hecke polynomial at a split place `w` of norm `q` away from
the places of `V` and their conjugates. Then minus the coefficient of `X ^ (n - 1)` in `H` is
`q ^ t ν / ν' * b w 1 + (∑_{i < t} q ^ i) ν`. Here `t = n - r`, `ν = V.charW.frobValue r w` and
`ν' = V.charV.frobValue n w`: for a character `χ` of `U(1)` and rank `N`, `χ.frobValue` is the value
at a uniformizer at `w` of the Hecke character `x ↦ χ(x / x̄) υ(x) ^ (-N)`, times `q ^ (N / 2)`. -/
lemma New.Selmer.neg_coeff_eq_of_hasLiftHeckePolynomial [DecidableEq n] (r_pos : 0 < Fintype.card r)
    {V : DescentPair D.E r n} {y : V.FormV} {b : FinPlace D.E → ℕ → ℂ}
    (hy_lifts : V.HasLiftHeckePolynomial y b)
    (hy_ne : (y : Gf D.E n → WeylIndex n V.columnCount → ℂ) ≠ 0) {w : FinPlace D.E}
    (hw_split : star w ≠ w) (hw_off : w ∉ V.places.conjClosure) {H : ℂ[X]}
    (hH : HasHeckePolyAt (y : Gf D.E n → WeylIndex n V.columnCount → ℂ) w hw_split H) :
    -H.coeff (Fintype.card n - 1) =
      w.q ^ V.rankDiff * V.charW.frobValue r w / V.charV.frobValue n w * b w 1 +
        (∑ i ∈ Finset.range V.rankDiff, (w.q : ℂ) ^ i) * V.charW.frobValue r w := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:297-327 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=17 body_sha256=863239ce6d2c05dc65dbce134bd8cc3b36bbbce624d5ac4906033f9c63a46950]

lemma New.Selmer.eventually_trace_frob_eq_of_hasLiftHeckePolynomial — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L329-L381)

lean
/-- The identity of traces at Frobenius elements. Let `O` be a descent pair over `D.E` of ranks
`r < n` with character `μ = O.u1Char`, let `c` be admissible labels for it and the trivial twist
(`IsLiftSetting`), and let `r - (n - r) = 2 a`. Let the descent pair `V` have character `μ ϑ`, with
`ϑ` tame, and let the eigenform `y` on `V` with Hecke polynomials `H` lift the system `b` of Hecke
eigenvalues. Then for most Frobenius elements `g = x.frob` at places `w = x.place`, minus the
coefficient of `X ^ (n - 1)` in `H w`, times `normalizingAvatar V g`, equals `θ₀(g) θ(g) b w 1`
plus the sum of the first `n - r` powers of the inverse cyclotomic character at `g`. An avatar is
the `ℓ`-adic Galois character of an algebraic Hecke character; `θ₀` and `θ` are those of
`ϑ.hasWeight.inv.toAlgebraic 0 0`, that is `ϑ⁻¹(x / x̄)`, and of `O.hasWeight.inv.toAlgebraic 0 a`,
that is `μ⁻¹(x / x̄) |x| ^ a`; `normalizingAvatar V` is the one made in the same way from the
inverse of the character `V.charW` of the space of rank `r`, with weight `-r`. Complex numbers are
carried to `ℓ`-adic ones by the isomorphism `ι.ιℓ`. -/
lemma New.Selmer.eventually_trace_frob_eq_of_hasLiftHeckePolynomial (ι : PadicIso ℓ) [DecidableEq n]
    {c : (i : O.ChosenIndex) → (ResField (O.chosenPlace i))[X]} (hO : IsLiftSetting O c 1) {a : ℤ}
    (ha : (Fintype.card r - O.rankDiff : ℤ) = 2 * a) {ϑ : D.TameChar} {V : DescentPair D.E r n}
    (hμ : V.u1Char = O.u1Char * ϑ.toAutChar) {y : V.FormV} {b : FinPlace D.E → ℕ → ℂ}
    (hy_lifts : V.HasLiftHeckePolynomial y b) {H : FinPlace D.E → ℂ[X]}
    (hy_eig : IsEigenform (y : Gf D.E n → WeylIndex n V.columnCount → ℂ) H) :
    ∀ᶠ x : FrobeniusDatum D.E in mostFrobenii D.E,
      -((normalizingAvatar V x.frob).val * ι.ιℓ ((H x.place).coeff (Fintype.card n - 1))) =
        ((ϑ.hasWeight.inv.toAlgebraic 0 0).avatar x.frob).val *
            (((O.hasWeight.inv.toAlgebraic 0 a).avatar x.frob).val * ι.ιℓ (b x.place 1)) +
          ∑ e ∈ Finset.range V.rankDiff, cyclotomicInv ℓ D.E (PadicAlgCl ℓ) x.frob ^ e := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:329-381 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=31 body_sha256=884b3511954e185a0f14a3e23f243bdf9984eb401dea7181acd90fbf671db788]

lemma New.Selmer.exists_isMainSummand_of_isRepOfType — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L383-L436)

lean
/-- Let `O` be a descent pair of ranks `r < n`, with weight `w` and `t = n - r`. Assume that the
labels `c` are admissible for `O` and the trivial twist (`IsLiftSetting`), and that `R` is a
representation with these labels, jumps `J` and empty level (`IsRepOfType`) whose trace at each `g`
is the limit of the Hecke eigenvalues `b v 1` along most Frobenius elements tending to `g`, at
places `v`, carried to `ℓ`-adic numbers by the isomorphism `ι.ιℓ : ℂ ≃+* ℚ̄_ℓ`. Assume also that the
jumps `J σ`, lowered by `(r - t) / 2 - cmSign σ * w v` with `v` the infinite place of `σ` and
`cmSign σ` equal to `1` on the CM type and `-1` off it, obey the numerical conditions
`IsMainSummandWeights`. Then there is a `T` with `IsMainSummand O b T`: a main summand that gives
the traces of the representations attached to the lifts of `b` for all tame twists of `O`. -/
lemma New.Selmer.exists_isMainSummand_of_isRepOfType (ι : PadicIso ℓ) [DecidableEq n]
    {c : (i : O.ChosenIndex) → (ResField (O.chosenPlace i))[X]}
    (hO : IsLiftSetting O c 1) (b : FinPlace D.E → ℕ → ℂ) (J : (D.E →+* ℂ) → Multiset ℤ)
    (R : GalRep ℓ D.E r) (hR : IsRepOfType O (Fintype.card r) J c ∅ R)
    (h_trace : ∀ g : Gal(Ω/D.E), Tendsto (fun x : FrobeniusDatum D.E ↦ ι.ιℓ (b x.place 1))
      (mostFrobeniiAt D.E g) (nhds (R g).val.trace))
    (hJ : IsMainSummandWeights D (Fintype.card r) O.rankDiff fun σ : D.E →+* ℂ ↦
      (J σ).map fun u : ℤ ↦ u - ((Fintype.card r - O.rankDiff) / 2 -
        cmSign σ * O.weight (NumberField.InfinitePlace.mk σ))) :
    ∃ T : GalRep ℓ D.E r, IsMainSummand O b T := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:383-436 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=36 body_sha256=96183547bd21a962e040f79d9fab9562adb278eb2b383e78885b767ab74d3916]

lemma New.Selmer.map_jumps_sub_eq_map_targetParameter — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L438-L459)

lean
/-- Let the weight `(d, κ)` give at each infinite place `v` of the CM field `D.E` (the type `D.Φ`) a
shape `d v` and an integer `κ v`, and suppose that its doubled Harish-Chandra parameter is
`D.paramW`, twice the target parameter `λ_q = D.targetParameter v q` in rank `r = D.r`. Put
`t = D.t`, and at a complex embedding `σ` over `v` let `ε = cmSign σ` be `1` on the CM type and
`-1` off it. Then the jumps (Hodge–Tate weights) of `(d, κ)` at `σ`, lowered by
`(r - t) / 2 + ε w` for any integer `w`, are the numbers `t / 2 - ε (λ_q + w)` for `q < r`. -/
lemma New.Selmer.map_jumps_sub_eq_map_targetParameter {d : D.Φ → ℕ → ℕ} {κ : D.Φ → ℤ}
    (hκ : IsHCParam d κ D.paramW) (σ : D.E →+* ℂ) (w : ℤ) :
    (jumps (d, κ) D.r σ).map (fun u : ℤ ↦ u - ((D.r - D.t) / 2 + cmSign σ * w)) =
      (Multiset.range D.r).map fun q : ℕ ↦
        (D.t / 2 - cmSign σ * (D.targetParameter (NumberField.InfinitePlace.mk σ) q + w) : ℤ) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:438-459 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=12 body_sha256=bb229b673b0ded7d7f3f154c81b38b3aa55a86c590a6e5b1a70436608bb6dfb6]

theorem New.Data.isEigenform_of_hasHeckePolyAt — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L461-L470)

lean
/-- A nonzero function with Hecke polynomial `Q w` at every split place `w` off the chosen places
and their conjugates is an eigenform for the system `Q`. -/
theorem New.Data.isEigenform_of_hasHeckePolyAt [DecidableEq n] (D : Data P) {M : Type}
    {f : Gf D.E n → M → ℂ} (hf : f ≠ 0) {Q : FinPlace D.E → ℂ[X]}
    (h_eig : ∀ (w : FinPlace D.E) (hw : D.IsSplitOffLevel w), HasHeckePolyAt f w hw.isSplit (Q w)) :
    IsEigenform f Q := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:461-470 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=5 body_sha256=b3c5254a76bae93a5bb418523aac699340a8f8465ffa7ddf51fe939d06941652]

theorem New.Selmer.exists_isMainSummand_descentPair — Upstream source (src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean L476-L561)

lean
/-- Let the Hecke eigenvalues `p (w, i)` occur in a nonzero good form on `D.spaceW D.m`: a form of
principal level at the chosen places, in the image of the idempotent `D.e₀`. Let `O` be the `j`-th
descent pair of the trivial twist, `1 ≤ j ≤ m = D.m`: its two spaces have dimensions `r = D.r` and
`r + t`, `t = D.t`, and its character has weight `-D.liftWeight j`. Then some `r`-dimensional
`ℓ`-adic Galois representation `T` of `D.E` has `IsMainSummand O` for `p`. -/
theorem New.Selmer.exists_isMainSummand_descentPair {ℓ : ℕ} [ThePrime ℓ] (ι : PadicIso ℓ)
    {p : FinPlace D.E × ℕ → ℂ}
    (h_ne_bot : D.goodForms (D.spaceW D.m) ⊓ D.eigenPart (D.spaceW D.m) p ≠ ⊥) (j : D.LiftIndex) :
    ∃ T : GalRep ℓ D.E D.RowIndex,
      IsMainSummand (D.descentPair TameChar.one j) (fun (w : FinPlace D.E) (i : ℕ) ↦ p (w, i))
        T := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/GaloisRepresentations/RowsFromEigensystems.lean:476-561 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=76 body_sha256=433888dcb6e7eac0982f75f276fecde9af1ecf47fd18f9a9481e1fa69f67707f]

lemma New.Selmer.norm_inv_le_exp_of_ellVal_le — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L57-L66)

lean
/-- If the image of a complex number `x` under `ιℓ : ℂ ≃ ℚ̄_ℓ` has `ℓ`-adic valuation at most `c`,
then the image of `x⁻¹` has norm at most `ℓ ^ c`. -/
lemma New.Selmer.norm_inv_le_exp_of_ellVal_le {ℓ : ℕ} [ThePrime ℓ] {ι : PadicIso ℓ} {x : ℂ} {c : ℝ≥0}
    (h_val : ellVal (ιℓ x : PadicAlgCl ℓ) ≤ c) :
    ‖(ιℓ x⁻¹ : PadicAlgCl ℓ)‖ ≤ exp (c * log ℓ) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:57-66 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=6 body_sha256=7f5dd1db33d1ae6a22aed2e097dddc754c9e7403d3fd746377db4ce6f9fcebc8]

lemma New.Selmer.mapRel_crysRelations_subset — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L73-L116)

lean
/-- Let `u` be a Galois representation over a coefficient ring `O ≤ O'`, and let `ψ` be an
`O'`-valued character that is trivial on the chosen decomposition groups above `ℓ`. A linear
relation that holds on the crystalline cocycles of `u` at a place above `ℓ`, with its coefficients
mapped to `O'`, is such a relation for the twist by `ψ` of the extension of `u` to `O'`. -/
lemma New.Selmer.mapRel_crysRelations_subset [DecidableEq n] {O' : CoeffRing ℓ} (hO : O ≤ O')
    (u : Gal(Ω/E) →* Matrix n n O) {ψ : Gal(Ω/E) →* O'}
    (hψ : ∀ v ∈ placesDividing E ℓ, ∀ g ∈ decompGroup Gal(Ω/E) (placeOver v), ψ g = 1) :
    mapRel (inclusion hO).toRingHom '' crysRelations u ⊆
      crysRelations
        (twistRep (.id O') ψ ((inclusion hO).toRingHom.mapMatrix.toMonoidHom.comp u)) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:73-116 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=35 body_sha256=cd3c21f6065b9b5252286bb7d611a5be05ad7f26a46e5bb8365c27ebfe1f0a9b]

lemma New.Selmer.IsSmallTwist.isAuxTwist — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L118-L145)

lean
/-- Let `S₀` be a finite set of places of `E` containing those above `ℓ`, and let `Q` be auxiliary
for `S₀`: its places have prime norm, and `Q`, its conjugate `Q̄` and `S₀` are pairwise disjoint.
Let `ψ` satisfy `IsSmallTwist T Y ε Q ψ`, the list of conclusions of `exists_anticyclotomic_twist`
for Galois lattices with local conditions `T i` and families `Y k` of group ring elements, both
attached to `S₀` and `g₀ ∈ Gal(Ω/E)`. Only two clauses are used, which involve neither `T` nor `Y`:
`ψ` comes by `x ↦ x / x̄` from an idele class character of modulus `Q` trivial above `ℓ`, and the
valuations of `ψ γ_w - 1` for tame inertia generators `γ_w`, `w ∈ Q ∪ Q̄`, have sum at most `ε`.
Then `IsAuxTwist S₀ Q ψ ε` holds: `Q` is auxiliary for `S₀` and prime to `ℓ`, `ψ` has the form
above, and the sum of these valuations over `w ∈ Q` is at most `ε`. -/
lemma New.Selmer.IsSmallTwist.isAuxTwist {S₀ Q : Finset (FinPlace E)} {g₀ : Gal(Ω/E)} {ι κ : Type}
    {r : ι → Type} [∀ i : ι, Fintype (r i)] [∀ i : ι, DecidableEq (r i)]
    {T : ∀ i : ι, SelmerDatum ℓ S₀ g₀ O (r i)} {Y : κ → StickelbergerSystem ℓ S₀ g₀} {ε : ℝ≥0}
    {ψ : Gal(Ω/E) →* PadicAlgCl ℓ} (hψ : IsSmallTwist T Y ε Q ψ) (hS₀ : placesDividing E ℓ ⊆ S₀)
    (hQ : IsAuxiliary S₀ Q) :
    IsAuxTwist S₀ Q ψ ε := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:118-145 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=14 body_sha256=973a2aedc9e49ab42e1523d9c7444345b81bf77ca83b86a83244866e26764bb5]

lemma New.Selmer.divisibleSelmerLength_le_divisibleLength — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L149-L168)

lean
/-- Let `T` be a Selmer datum over `O₀`: a Galois lattice `T.ρ` unramified outside the finite set
`T.places ⊆ S₀`, with modules of local cocycles at the places above `ℓ` and an inertial element
`T.γ` that acts by a scalar. Let `O` be a discrete valuation ring, `e : O₀ → O` a ring map, `ρ` the
twist by the `O`-valued character `ψ` of `T.ρ` extended along `e`, and `S = T.places ∪ Q ∪ Q̄`. The
group `Sel_Q(T ψ)`, of length `T.divisibleLength Q e ψ`, consists of the cocycles for `ρ` unramified
outside `S` that obey the images under `e` of the relations `T.classRelations`. If the set of linear
relations `L` contains these images, then the module of cocycles for `ρ` unramified outside `S` that
obey `L` is at most as long as `Sel_Q(T ψ)`, both with coefficients in `Frac(O) / O`. -/
lemma New.Selmer.divisibleSelmerLength_le_divisibleLength {ℓ : ℕ} [ThePrime ℓ] {E O n : Type} [Field E]
    [CMFieldWithRoot5040 E] [CommRing O] [DVR O] [Fintype n] [DecidableEq n]
    {ρ : Gal(Ω/E) → Matrix n n O} {S : Set (FinPlace E)} {L : Set (Gal(Ω/E) →₀ Matrix n n O)}
    {O₀ : Type} [CommRing O₀] [PadicIntegerRing O₀ ℓ]
    {S₀ : Finset (FinPlace E)} {g₀ : Gal(Ω/E)} (T : SelmerDatum ℓ S₀ g₀ O₀ n)
    {Q : Finset (FinPlace E)} {e : O₀ →+* O} {ψ : Gal(Ω/E) →* O}
    (hρ : ρ = twistRep e ψ T.ρ) (hS : S = unionWithConj T.places Q)
    (hL : mapRel e '' T.classRelations ⊆ L) :
    divisibleSelmerLength ρ S L ≤ T.divisibleLength Q e ψ := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:149-168 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=4 body_sha256=ab623224ac87819716cc91fd17c720ca3ce98e15862f50e3bbcb6a73ffb5ed6b]

lemma New.Selmer.SelmerDatum.apply_γ_eq_one — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L170-L187)

lean
/-- Let `T` be a Selmer datum for `S₀`: a Galois lattice unramified outside `S₀` with local
conditions above `ℓ` and an element `T.γ`, inertial at a place of `S₀`, that acts by a scalar. Let
`Q` be auxiliary for `S₀`, so that neither `Q` nor `Q̄` meets `S₀`. A character `ψ` that comes by
`x ↦ x / x̄` from an idele class character of modulus `Q` trivial above `ℓ` is trivial at `T.γ`. -/
lemma New.Selmer.SelmerDatum.apply_γ_eq_one {ℓ : ℕ} [ThePrime ℓ] {E O n : Type} [Field E]
    [CMFieldWithRoot5040 E] [CommRing O] [PadicIntegerRing O ℓ] [Fintype n] [DecidableEq n]
    {S₀ Q : Finset (FinPlace E)} {g₀ : Gal(Ω/E)} (T : SelmerDatum ℓ S₀ g₀ O n)
    {ψ : Gal(Ω/E) →* PadicAlgCl ℓ} (hQ : IsAuxiliary S₀ Q)
    (hψ : IsFromU1 (placesDividing E ℓ) Q ψ) : ψ T.γ = 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:170-187 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=10 body_sha256=087f63f824b94d92bd2776e23f737bfa7b705fb6bb8d2821579fd7976fd118fa]

lemma New.Selmer.SelmerDatum.TwistedLengthLe.hasDivisibleSelmerLengthLe — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L189-L240)

lean
/-- Let `D` be admissible data, with CM field `D.E`, primes `p₀, p₁` and level `D.N`;
`badPlaces D ℓ` is the set of places dividing `ℓ p₀ p₁ D.N`. Let `R` be an `ℓ`-adic representation
of the Galois group of `D.E`, and `T` a Selmer datum over `O` whose representation `T.ρ` is
conjugate to `R` over `ℚ̄_ℓ`, whose places are those above `ℓ p₀ p₁` and whose local conditions are
the crystalline ones; the inertial element `T.γ` acts by the scalar `T.ζ`. Let the places of `Q`
have prime norm, with `Q`, `Q̄` and the bad places pairwise disjoint, and let `ψ` come by
`x ↦ x / x̄` from an idele class character of modulus `Q` trivial above `ℓ`. Suppose that for all
large coefficient rings `O' ⊇ O` the character `ψ` has values in `O'` and `Sel_Q(T ψ)` has length at
most `b`, where `O' / ℓ` has length `1`. Then for all large `O'` there is a lattice in `ψ R` on
which `T.γ` acts by `T.ζ` and whose crystalline Selmer group for `Q` and `T.γ` has length at most
`b`. -/
lemma New.Selmer.SelmerDatum.TwistedLengthLe.hasDivisibleSelmerLengthLe {ℓ : ℕ} [ThePrime ℓ] {P : Parameters}
    {D : Data P} {n : Type} [Fintype n] [DecidableEq n]
    {O : CoeffRing ℓ} {g₀ : AbsGal D} {T : SelmerDatum ℓ (badPlaces D ℓ) g₀ O n}
    {Q : Finset (FinPlace D.E)} {ψ : AbsGal D →* PadicAlgCl ℓ} {b : ℝ≥0∞}
    (hT_length : T.TwistedLengthLe Q ψ b) {R : GalRep ℓ D.E n} (h_lattice : IsLatticeIn R T.ρ)
    (hT_places : (T.places : Set (FinPlace D.E)) = placesDividing D.E ℓ ∪ placesAboveM D)
    (hT_crys : T.localRelations = crysRelations T.ρ) (hQ : IsAuxiliary (badPlaces D ℓ) Q)
    (hψ : IsFromU1 (placesDividing D.E ℓ) Q ψ) :
    HasDivisibleSelmerLengthLe ψ R Q T.γ b := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:189-240 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=33 body_sha256=cf8f57239914c70e43f6446b30df00cdb68f8cd4b5262a57e1ef37fffc572b32]

lemma New.Selmer.four_mul_ellVal_levelPrime_sub_one_add_le_twistError — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L242-L259)

lean
/-- For each of the two primes `p_i = D.levelPrime i` of the admissible data `D`, the number
`4 v(p_i - 1) + 2 ^ (-ℓ)` is at most
`twistError ℓ D = (4 D.f + 3) D.r v(D.chosenGroupOrder) + 2 ^ (-ℓ)`, where `v` is the `ℓ`-adic
valuation with `v(ℓ) = 1`. -/
lemma New.Selmer.four_mul_ellVal_levelPrime_sub_one_add_le_twistError {ℓ : ℕ} [ThePrime ℓ] {P : Parameters}
    {D : Data P} (i : Fin 2) :
    4 * ellVal (D.levelPrime i - 1 : PadicAlgCl ℓ) + ((1 / 2) ^ ℓ : ℝ≥0) ≤ twistError ℓ D := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:242-259 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=12 body_sha256=bf1c247e8e8cb8fc8ac4ef85815f7819726dd375954d6bb797b87e7ac6b30385]

lemma New.Selmer.invAvatar_pow — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L261-L269)

lean
/-- For a tame character `τ` and `j : ℕ`, `(τ.pow j).invAvatar`, the `ℓ`-adic Galois character
attached to the inverse of `τ ^ j`, is the `j`-th power of `τ.invAvatar`. -/
lemma New.Selmer.invAvatar_pow {ℓ : ℕ} [ThePrime ℓ] {P : Parameters} {D : Data P} [PadicIso ℓ]
    (τ : D.TameChar) (j : ℕ) :
    (τ.pow j).invAvatar = (τ.invAvatar : AbsGal D →* PadicAlgCl ℓ) ^ j := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:261-269 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=5 body_sha256=2ec8b4a7251ebbebd5c2331998545e924ec7c33e2731ab66c6af6eb2163fcc1f]

lemma New.Selmer.tamePart_ne_one_of_invAvatar_ne_one — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L271-L291)

lean
/-- Let `τ` be a character of `U(1)(𝔸)` of weight `0` for the CM field `D.E` whose tame part, a
character `τ.tamePart w` of the residue field at each finite place `w`, is supported on `τ.Q`. Let
`τ.invAvatar` be the `ℓ`-adic Galois character that class field theory and the fixed isomorphism
`ℂ ≃ ℚ̄_ℓ` attach to the base change of `τ⁻¹` to `D.E`. If it is non-trivial at an element `g` of an
inertia group above a place `w` of `τ.Q`, then the tame part of `τ` at `w` is non-trivial. -/
lemma New.Selmer.tamePart_ne_one_of_invAvatar_ne_one {ℓ : ℕ} [ThePrime ℓ] {P : Parameters} {D : Data P}
    [PadicIso ℓ] (τ : D.TameChar) {w : FinPlace D.E}
    (hw : w ∈ τ.Q) {g : AbsGal D} (hg : g ∈ inertiaAbove ({w} : Set (FinPlace D.E)))
    (h_ne : (τ.invAvatar : AbsGal D →* PadicAlgCl ℓ) g ≠ 1) : τ.tamePart w ≠ 1 := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:271-291 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=13 body_sha256=9be0c3c3b2cc3d69729ebd7436bccb391a43174a48bcc6e33777d79f8e559000]

lemma New.Selmer.exists_selmerData_isTorsionLevel — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L294-L345)

lean
/-- Let `D` be admissible data, with CM field `D.E` and primes `p₀, p₁`, and let `badPlaces D ℓ` be
the places dividing `ℓ p₀ p₁ D.N`. Fix an isomorphism `ℂ ≃ ℚ̄_ℓ` and finitely many `ℓ`-adic
representations `R i` of the Galois group of `D.E` that satisfy `IsMainSummandLike`. Let `w` be a
chosen place, that is, one dividing the factor `D.piM` of `p₀ p₁`, prime to `ℓ`. Let
`c = (4 f + 3) · D.r · v(D.chosenGroupOrder)`, where `f = D.f` is the number of infinite places of
`D.E`, `v` is the `ℓ`-adic valuation and `D.chosenGroupOrder` is the product of the orders of
`GL (D.r * D.t)` over the residue fields of the chosen places. Over some coefficient ring `O` every
`R i` has a lattice that carries a Selmer datum `T i` for the bad places and a generator `g₀` of
tame inertia at `w`. It is unramified outside `ℓ p₀ p₁` and its local conditions are the crystalline
ones. Its error term `(T i).β`, a sum of a global term and of local terms among which is the
valuation of `det((T i).ρ g₀ - 1)`, is at most `c` when `O / ℓ` is given length `1`. Finally
`IsTorsionLevel T (c + 2)` holds: `c + 2` exceeds each such `β` by more than `1`, and the residue
field of `O` has more than `2 rank(T i) len(O / ℓ ^ (c + 2)) + 1` elements. -/
lemma New.Selmer.exists_selmerData_isTorsionLevel {ℓ : ℕ} [ThePrime ℓ] {P : Parameters} {D : Data P}
    [PadicIso ℓ] {I : Type} [Finite I] {r : I → Type}
    [∀ i : I, Fintype (r i)] [∀ i : I, DecidableEq (r i)] {R : ∀ i : I, GalRep ℓ D.E (r i)}
    (hR : ∀ i : I, ∃ (t : ℕ) (J : (D.E →+* ℂ) → Multiset ℤ), IsMainSummandLike D t J (R i))
    {w : FinPlace D.E} (hw : D.IsChosen w) (hwℓ : w ∈ placesAboveM D \ placesDividing D.E ℓ)
    {c : ℕ} (hc : c = (4 * D.f + 3) * D.r * padicValNat ℓ D.chosenGroupOrder) :
    ∃ (O : CoeffRing ℓ) (T : ∀ i : I,
        SelmerDatum ℓ (badPlaces D ℓ) w.isPlaceOver_placeOver.tameGenerator O (r i)),
      (∀ i : I, IsLatticeIn (R i) (T i).ρ) ∧
      (∀ i : I, ((T i).places : Set (FinPlace D.E)) = placesDividing D.E ℓ ∪ placesAboveM D) ∧
      (∀ i : I, (T i).localRelations = crysRelations (T i).ρ) ∧
      (∀ i : I, O.normLength (T i).β ≤ c) ∧
      IsTorsionLevel T (c + 2) := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:294-345 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=27 body_sha256=fa166d738add3d7bae88ed684b07d12b7a835869bbcb1264156dacd69b0aea64]

theorem New.Selmer.exists_mFoldTwist_hasDivisibleSelmerLengthLe — Upstream source (src/New/Congruences/Selmer/TwistingTheorem.lean L349-L452)

lean
/-- The twisting theorem. Let `D` be admissible data for the parameters `P` (a modulus and the field
`K = ℚ(√-d)`), with CM field `D.E`, primes `p₀, p₁` and level `D.N`. The bad places are those
dividing `ℓ p₀ p₁ D.N`; the chosen places are those dividing the factor `D.piM` of `p₀ p₁` from `K`.
Fix an isomorphism `ιℓ : ℂ ≃ ℚ̄_ℓ` (the datum `ι`) and finitely many `ℓ`-adic representations `R i`
of the Galois group of `D.E` that satisfy `IsMainSummandLike D t J` for some `t` and `J`:
`R^c ≅ R^∨(1 - t)`, `J` gives the jumps at the complex embeddings, the image is large and inertia
above `p₀ p₁` is controlled. Let
`e'_ℓ = twistError ℓ D = (4 D.f + 3) D.r v(D.chosenGroupOrder) + 2 ^ (-ℓ)`, with `v` the `ℓ`-adic
valuation. Then there is a character `τ` of `U(1)(𝔸)` of weight `0`, tamely ramified on a finite set
`Q` of places, such that each power `ξ = τ ^ j` with `1 ≤ j ≤ D.m` is ramified at every place of
`Q = ξ.Q` (`D.MFoldTwist`) and satisfies:
* the `ℓ`-adic Galois character `ψ = ξ.invAvatar` attached to `ξ⁻¹` is anticyclotomic and trivial
  above `ℓ`; the places of `Q` have prime norm, and `Q`, `Q̄` and the bad places are pairwise
  disjoint; `∑ v(ψ γ_w - 1) ≤ e'_ℓ` for some tame inertia generators `γ_w`, `w ∈ Q`;
* for each `i` there are an inertial element `γ` away from `ℓ` and a scalar `ζ`, with `ζ - 1` a
  unit, such that over all large coefficient rings `O` the element `γ` acts by `ζ` on a lattice in
  `ψ R i`, and the module of cocycles with coefficients in `Frac(O) / O` that are unramified outside
  `ℓ p₀ p₁`, `Q`, `Q̄`, crystalline above `ℓ` and zero at `γ` has length at most `e'_ℓ` (`O / ℓ` has
  length `1`);
* for each pair `p = (ν, z)` of a character `ν` of `U(1)(𝔸)` of weight `-c` and an integer
  `1 ≤ z ≤ D.t` with `z ≤ c ≤ 4 D.b`, the tame part of `ν` being non-trivial exactly at the chosen
  places, and each sign `s = ±1`, the image under `ιℓ` of `|L(z, (ν ξ^s)⁻¹)| / |L(z, ν⁻¹)|` has
  valuation at most `e'_ℓ`. The Euler factors at the chosen places, in the numerator also at `Q`,
  and at their conjugates are omitted. -/
theorem New.Selmer.exists_mFoldTwist_hasDivisibleSelmerLengthLe {P : Parameters} (D : Data P) (ℓ : ℕ)
    [ThePrime ℓ] (ι : PadicIso ℓ) {I : Type} [Finite I] {r : I → Type} [∀ i : I, Fintype (r i)]
    [∀ i : I, DecidableEq (r i)] {R : ∀ i : I, GalRep ℓ D.E (r i)}
    (hR : ∀ i : I, ∃ (t : ℕ) (J : (D.E →+* ℂ) → Multiset ℤ), IsMainSummandLike D t J (R i)) :
    ∃ τ : D.MFoldTwist, ∀ j : D.LiftIndex,
      let ξ : D.Twist := by
  sorry -- [EXTRACTED_STUB upstream=src/New/Congruences/Selmer/TwistingTheorem.lean:349-452 commit=41c2716658c42ba08eb0648994a2efe83082a95c body_lines=75 body_sha256=3a54849ae0dc14c0226bb1e77184cc0e43eda35f8db098d7e41c53bbe11aae0e]

Page Glossary ​

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.
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).
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.
central idempotent
A class-function element of a finite group algebra satisfying z² = z that acts as a G-equivariant orthogonal projection, splitting good cuspidal types from rare bad types across two level primes.
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.
theta correspondence
An integral transform built from a two-variable theta kernel that carries automorphic forms from one unitary group to another, iterated along a ladder of Hermitian spaces and packaged via admissible chain data.
Galois main summand
The fixed, twist-independent rank-r (or rank-1) l-adic Galois representation R extracted from a Hecke eigensystem whose trace, after twisting by theta^(-1) and adding the inverse-cyclotomic string sum_{e < t} chi_cyc^(-e), matches every twisted theta lift.
anticyclotomic Selmer twisting
Choosing one finite-order anticyclotomic m-fold twist tau on auxiliary places Q so that all powers xi = tau^j (1 <= j <= m) simultaneously keep ramification, divisible crystalline Selmer lengths of finitely many main summands, and all ramified Hecke L-value ratio valuations within twistError l D = (4f + 3)r v_l(chosenGroupOrder) + 2^(-l).
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.