import Mathlib
import Development.AbelianVarietyTheory.Proofs.DivisorProofs.FlagPointOverNumberField
import Mathlib
import Development.AbelianVarietyTheory.Proofs.DivisorProofs.StepLatZero
open NumberField GlobalTheory.ShFam.Pad AlgebraicGeometry CategoryTheory
set_option maxHeartbeats 1000000 in
theorem _root_.GlobalTheory.T.flag_point_over_number_field : ∀ {E : Type} [Field E] [NumberField E] [IsCMField E] {H : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Host E} {Dw : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Datum H} {l : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Level H} {Xo : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Moduli Dw l} {c : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Coeff l} (Z : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Model Xo c (algebraMap (𝓞 c.F) c.F)) (y : GlobalTheory.ShFam.Pad.FlagPt Z Qb) (K : Type) [Field K] [NumberField K] (ι : K →+* Qb) (jF : c.F →+* K) (yK : ReciprocityTheory.ChartRestriction.G.Geo.Tor.Sp K ⟶ GlobalTheory.Toroidal.gen Z) (uK : ∀ τ : E →+* ℂ, Fin (Dw.mult τ) → (ReciprocityTheory.ChartRestriction.G.Geo.Tor.Sp (DualNumber K) ⟶ Z.t.G.left)), ι.comp jF = y.fK → ReciprocityTheory.ChartRestriction.G.Geo.Tor.spMap ι ≫ yK = y.y → yK ≫ GlobalTheory.Toroidal.genStr Z = ReciprocityTheory.ChartRestriction.G.Geo.Tor.spMap jF → (∀ τ i, y.u τ i = ReciprocityTheory.ChartRestriction.G.Geo.Tor.spMap (ReciprocityTheory.ChartRestriction.G.Chart.dualMapR ι) ≫ uK τ i) → ∀ (P₀ : ReciprocityTheory.ChartRestriction.G.Out.PolAV (ReciprocityTheory.ChartRestriction.G.Geo.Tor.Sp K)) (θ : P₀.A.left ⟶ Z.t.G.left), ReciprocityTheory.ChartRestriction.G.Geo.Tor.IsGrpPullback P₀.A Z.t.G (yK ≫ GlobalTheory.Toroidal.genι Z) θ → ∀ n : ℕ, n = (GlobalTheory.ShFam.Pad.letters Dw).length → ∃ v : Fin n → (ReciprocityTheory.ChartRestriction.G.Geo.Tor.epsR K ⟶ P₀.A), ReciprocityTheory.ChartRestriction.G.Geo.Tor.IsLieBasis v ∧ ∀ (k : Fin n) (x : GlobalTheory.ShFam.Pad.Letter Dw), (GlobalTheory.ShFam.Pad.letters Dw)[(k : ℕ)]? = some x → (v k).left ≫ θ = uK x.1 x.2 := by
  first | exact @GlobalTheory.FibLie.exists_lieBasis | exact GlobalTheory.FibLie.exists_lieBasis | (intros; apply GlobalTheory.FibLie.exists_lieBasis <;> assumption)
