import Mathlib
import Development.AbelianVarietyTheory.Definitions.LatticeFrames.SplitPart
import Development.AbelianVarietyTheory.Proofs.DecoratedLatticeProofs.StrongApproximationDecomposition
open Formalism.BasicNotions Formalism.BasicNotions.TH Formalism.MainNotions.GlobalTheoryTheory.GenusMassVolumes Formalism.MainNotions.StandardLattice Formalism.L2.Theta Formalism.IndefR Formalism.IndefR.Datum Formalism.IndefR.Links Formalism.L2.Forms Formalism.L2.Ker Formalism.UG
open NumberField IsDedekindDomain Matrix MeasureTheory GlobalTheory.Mem GlobalTheory.Mem.Col2 GlobalTheory.MixPer GlobalTheory.Core.Rk GlobalTheory.AdForm
open scoped TensorProduct Classical
attribute [local instance] Formalism.BasicNotions.Host.cmStar

noncomputable section

namespace GlobalTheory.AdForm.MovesOne

theorem finM_one {D : D7} (V : HSp D) {n : ℕ} (hn : V.rank = n) : finM V hn (1 : GA D V) = 1 := by
  subst hn
  unfold finM Formalism.L2.Theta.mt
  rw [map_one, Units.val_one, Matrix.map_one _ (map_zero _) (map_one _)]
  simp

theorem moves_one : ∀ (D : D7) (V : HSp D) (n : ℕ) (hn : V.rank = n) (N : Submodule (𝓞 D.host.E) (Fin n → D.host.E)),
    Moves V hn 1 N → N = Formalism.L2.Col.stdLat D.host.E n := by
  intro D V n hn N h
  ext x
  rw [h x, inv_one, finM_one, Matrix.one_mulVec]
  simp only [GlobalTheory.SplitDec.rat_int_iff]
  exact ⟨fun hx i _ => hx i, fun hx i => hx i trivial⟩

end GlobalTheory.AdForm.MovesOne
