module public import Aesop.BuiltinRules public import Lib.Adelic.Unitary.Defs import Lib.Adelic.Adeles.StrongApproximation import Lib.General.LinearAlgebra.PartnerAlgebra /-! # The Gram matrix of a space is invertible and hermitian; group elements from isometries Let `E` be a number field and `s : n → ℤˣ` a family of signs. The standard form `New.stdForm E s` is its own inverse. It is hermitian when `E` has a CM type (`CMType E`), and then the Gram matrix of a space is invertible and hermitian. For a CM field, matrices that preserve the standard form give elements of the adelic unitary group. ## Notation * `New.𝔸 E`: the adeles of `E`, with the diagonal embedding `New.toAdele : E →+* 𝔸 E`, given at the infinite places by the chosen CM type of `E`. * `New.stdForm E s`: the diagonal adelic matrix with the signs `s` at the infinite places and `1` at the finite places. * `New.Space E n s`: a matrix `J` over `E` with an invertible adelic matrix `x` such that `xᴴ * J.map toAdele * x` is `New.stdForm E s`. * `New.G E s`: the adelic unitary group of the standard form; `New.G.adeleMatrix` is the matrix of an element. ## Main definitions and results * `New.Space.isUnit_J`, `New.Space.isHermitian_J`: `J` is invertible and hermitian. * `New.G.ofMatrix`: the group element given by a matrix that preserves the standard form. -/ @[expose] public section section SpaceGram open NumberField Matrix namespace New section variable {E : Type*} [Field E] [NumberField E] {n : Type*} [Fintype n] [DecidableEq n] {s : n → ℤˣ} /-- The standard form `stdForm E s`, which is diagonal with the signs `s` at the infinite places and `1` at the finite places, is its own inverse. -/ @[simp] lemma stdForm_mul_self : stdForm E s * stdForm E s = 1 := by simp [stdForm, funext_iff, ← Int.cast_mul] omit [Fintype n] in /-- The standard form `stdForm E (1 : n → ℤˣ)` is the identity matrix. -/ @[simp] lemma stdForm_one : stdForm E (1 : n → ℤˣ) = 1 := by rw [stdForm, ← diagonal_one, diagonal_eq_diagonal_iff] intro i ext <;> simp /-- The standard form `stdForm E s` is a unit in the matrix ring. -/ @[simp] lemma isUnit_stdForm : IsUnit (stdForm E s) := .of_mul_eq_one _ stdForm_mul_self end /-- The standard hermitian form `xᴴ x` over the CM field `E` is anisotropic. -/ lemma eq_zero_of_star_dotProduct_self {E p : Type*} [Field E] [CMType E] [Fintype p] {x : p → E} (hx : star x ⬝ᵥ x = 0) : x = 0 := by -- Any complex embedding `φ` turns the conjugation of `E` into complex conjugation. obtain ⟨φ⟩ : Nonempty (E →+* ℂ) := inferInstance have h_image : star (φ ∘ x) ⬝ᵥ (φ ∘ x) = 0 := by simpa [dotProduct, map_star_complex] using congrArg φ hx open ComplexOrder in exact φ.injective.comp_left (by simpa using dotProduct_star_self_eq_zero.1 h_image) variable {E : Type*} [Field E] [CMType E] {n : Type*} [Fintype n] [DecidableEq n] {s : n → ℤˣ} omit [Fintype n] in /-- The standard form `stdForm E s`, a diagonal matrix with the signs `s` at the infinite places and `1` at the finite places, is hermitian. -/ @[simp] lemma conjTranspose_stdForm : (stdForm E s)ᴴ = stdForm E s := by rw [stdForm, diagonal_conjTranspose, diagonal_eq_diagonal_iff] intro i ext <;> simp /-- The diagonal embedding `toAdele` of `E` in its adeles, given at the infinite places by the CM type, commutes with the conjugate transpose of matrices. -/ @[simp] lemma conjTranspose_map_toAdele {m k : Type*} (a : Matrix m k E) : (a.map toAdele)ᴴ = aᴴ.map toAdele := by exact (conjTranspose_map _ fun x ↦ (star_toAdele x).symm).symm namespace Space /-- At the infinite place `w` the frame `V.x` carries the form `V.J` to the diagonal matrix of the signs `s`. -/ lemma gram_map_evalInf {E n : Type} [Field E] [CMType E] [Fintype n] [DecidableEq n] {s : n → ℤˣ} (V : Space E n s) (w : InfinitePlace E) : (V.x.map (evalInf w)).valᴴ * V.J.map (Φ w) * (V.x.map (evalInf w)).val = signMatrix s := by have h_map : (V.x.valᴴ * V.J.map toAdele * V.x.val).map (evalInf w) = signMatrix s := by simp [V.gram_point, stdForm, signMatrix] rwa [map_conjTranspose_mul_mul (evalInf w) fun _ ↦ rfl, Matrix.map_map] at h_map /-- A space `V` is a matrix `J` over `E` with an invertible adelic matrix `x` such that `xᴴ J x = S`, where `S = stdForm E s` is the diagonal matrix of signs and `toAdele` maps `E` to its adeles. Over the adeles `J = (x⁻¹)ᴴ S x⁻¹`. -/ lemma map_J (V : Space E n s) : V.J.map toAdele = V.x⁻¹.valᴴ * stdForm E s * V.x⁻¹.val := (gram_inv_of_gram_eq V.gram_point).symm /-- The Gram matrix `V.J` of a space `V` is a unit in the matrix ring. -/ @[simp] lemma isUnit_J (V : Space E n s) : IsUnit V.J := by have h_adelic : IsUnit (toAdele.mapMatrix V.J) := by simp [map_J] exact isUnit_of_mapMatrix toAdele h_adelic /-- Over the adeles, `V.J⁻¹` is a left inverse to `V.J`. -/ lemma map_J_inv_mul_map_J (V : Space E n s) : V.J⁻¹.map toAdele * V.J.map toAdele = 1 := by have h_det : IsUnit V.J.det := (isUnit_iff_isUnit_det V.J).mp V.isUnit_J simp [← Matrix.map_mul, nonsing_inv_mul V.J h_det] /-- Over the adeles, `V.J⁻¹` equals `V.x.val * stdForm E s * V.x.valᴴ`, where `V.x` is the point of `V`, an invertible adelic matrix. -/ lemma map_J_inv (V : Space E n s) : V.J⁻¹.map toAdele = V.x.val * stdForm E s * V.x.valᴴ := by have h_gram_mul_stdForm : V.x.valᴴ * V.J.map toAdele * V.x.val * stdForm E s = 1 := by rw [V.gram_point, stdForm_mul_self] have h_right_inv : V.J.map toAdele * (V.x.val * stdForm E s * V.x.valᴴ) = 1 := by rw [← mul_assoc, mul_eq_one_comm] simpa only [mul_assoc] using h_gram_mul_stdForm exact left_inv_eq_right_inv V.map_J_inv_mul_map_J h_right_inv /-- The Gram matrix `V.J` of a space `V` is Hermitian. -/ lemma isHermitian_J (V : Space E n s) : V.J.IsHermitian := by have h_adelic : V.Jᴴ.map toAdele = V.J.map toAdele := by simp [← conjTranspose_map_toAdele, map_J, mul_assoc] exact map_injective toAdele.injective h_adelic /-- The conjugate transpose of the Gram matrix `V.J` equals `V.J`. -/ lemma conjTranspose_J (V : Space E n s) : V.Jᴴ = V.J := V.isHermitian_J.eq /-- The Gram matrix `J` of a space `V` is hermitian, so for matrices `X`, `Y` over `E` with rows indexed by `n`, the matrix `Yᴴ J X` is the conjugate transpose of `Xᴴ J Y`. -/ lemma conjTranspose_mul_J_mul_swap (V : Space E n s) {a b : Type*} (X : Matrix n a E) (Y : Matrix n b E) : Yᴴ * V.J * X = (Xᴴ * V.J * Y)ᴴ := by rw [conjTranspose_mul, conjTranspose_mul, conjTranspose_conjTranspose, V.conjTranspose_J, Matrix.mul_assoc] end Space end New end SpaceGram namespace New open scoped Matrix variable {E : Type*} [Field E] [NumberField E] [NumberField.IsCMField E] {n : Type*} [Fintype n] [DecidableEq n] {s : n → ℤˣ} /-- The element of the adelic unitary group `G E s` given by an adelic matrix `m` with `mᴴ S m = S`, where `S` is the standard form `stdForm E s`. -/ noncomputable def G.ofMatrix (m : Matrix n n (𝔸 E)) (h : mᴴ * stdForm E s * m = stdForm E s) : G E s := toUnitary.symm (U.of isUnit_stdForm m h) /-- For a CM field `E` and signs `s` indexed by a finite type `n`, let `S = stdForm E s` be the diagonal adelic matrix with the signs `s` at the infinite places and `1` at the finite places. If an adelic matrix `m` satisfies `mᴴ S m = S`, the element `G.ofMatrix m h` of the adelic unitary group `G E s` of `S` has matrix `m`. -/ @[simp] lemma G.adeleMatrix_ofMatrix (m : Matrix n n (𝔸 E)) (h : mᴴ * stdForm E s * m = stdForm E s) : (ofMatrix m h).adeleMatrix = m := rfl end New