import Mathlib
import Development.AbelianVarietyTheory.Proofs.DivisorProofs.IsFockMap
import Development.AbelianVarietyTheory.Definitions.Divisors.DiscreteSeriesHermitianUnique

noncomputable section

open Formalism.BasicNotions.TH

namespace GlobalTheory.RealLift.Dbl

def dblCol {β : Type} {R S : ℕ} (C : Matrix β (Ix R S) ℂ) : Ix (R + S) (S + R) → β ⊕ β → ℂ
  | .inl p => Sum.elim (fun r => Sum.elim (fun i => C i (.inl r)) (0 : β → ℂ))
      (fun s => Sum.elim (0 : β → ℂ) (fun i => C i (.inr s))) (finSumFinEquiv.symm p)
  | .inr q => Sum.elim (fun s => Sum.elim (fun i => C i (.inr s)) (0 : β → ℂ))
      (fun r => Sum.elim (0 : β → ℂ) (fun i => C i (.inl r))) (finSumFinEquiv.symm q)

def dblM {β : Type} {R S : ℕ} (C : Matrix β (Ix R S) ℂ) : Matrix (β ⊕ β) (Ix (R + S) (S + R)) ℂ :=
  Matrix.of fun i j => dblCol C j i

end GlobalTheory.RealLift.Dbl

end
