import Mathlib
import Development.AbelianVarietyTheory.Proofs.DivisorProofs.ConjInvariantNormPotentialComb
import Development.AbelianVarietyTheory.Proofs.DivisorProofs.DualRef
open CategoryTheory AlgebraicGeometry NumberField ReciprocityTheory.ChartRestriction.G ReciprocityTheory.ChartRestriction.G.Semi ReciprocityTheory.ChartRestriction.G.Geo.Tor ReciprocityTheory.AnForm ReciprocityTheory.AnForm.M
open Formalism.BasicNotions GlobalTheory GlobalTheory.Cartier GlobalTheory.ProjVar GlobalTheory.TrueGeo GlobalTheory.ArInt GlobalTheory.Mean4 GlobalTheory.Mean4O
set_option maxHeartbeats 1000000 in
theorem _root_.GlobalTheory.T.conj_invariant_norm_potential_comb : ∀ (F : Type) [Field F] [NumberField F] (C : CxSt F) (Y : Var F) (e : ℕ) (M : Man e) (I : ManIs M Y) (ι : Type) [Fintype ι] (Δ : ι → Y.Dv) (m : ∀ i σ, C.Met Y σ (Δ i)) (n : ι → ℤ) (u : M.Fun) (P : M.Pot), (∀ i (σ σ' : F →+* ℂ) (y : Pts Y σ) (y' : Pts Y σ'), y'.1 = spMap (starRingEnd ℂ) ≫ y.1 → C.pn Y σ' (Δ i) (m i σ') (C.cx Y σ' (genAt (Δ i) (under y'))) y' = C.pn Y σ (Δ i) (m i σ) (C.cx Y σ (genAt (Δ i) (under y))) y) → M.Smooth u → (∀ a a' x x', (I.pt a' x').1 = spMap (starRingEnd ℂ) ≫ (I.pt a x).1 → u a' x' = u a x) → (∀ a, IsPotential (M.A a) (P a)) → (∀ a, ∃ Q : ι → LocPot (M.X a), (∀ i, IsPot (I.pt a) (m i _) (Q i) ∧ IsPotential (M.A a) (Q i)) ∧ ∀ j, ∀ y ∈ ((M.A a).chart j).target, ∀ w, leviAt (M.A a) (P a) j y w = ∑ i, (n i : ℝ) * leviAt (M.A a) (Q i) j y w + leviAt (M.A a) (LocPot.ofFun (u a)) j y w) → ∃ N : HermLB Y.str, ∀ (f : M.Fun) (g : ∀ σ : F →+* ℂ, Pts Y σ → ℝ), M.Smooth f → (∀ a x, g (I.ε a) (I.pt a x) = f a x) → chInt N e g = ∑ a, mInt (M.A a) (fun _ => P a) (f a) := by
  first | exact @GlobalTheory.Mean4O.CombForm.combForm | exact GlobalTheory.Mean4O.CombForm.combForm | (intros; apply GlobalTheory.Mean4O.CombForm.combForm <;> assumption)
