import Lib.General.LinearAlgebra.HermitianMatrices import Lib.General.Measure.HaarNormalisation /-! # Cayley chart and an explicit Haar measure on the unitary group U(J) For a hermitian involution J, this file builds an explicit Haar measure on the unitary group `New.U J` through the Cayley chart and shows how it transforms. The Jacobians of the chart are computed from the logarithmic derivative `Φᴴ J dΦ`, with real coordinates on skew-hermitian matrices. ## Main definitions and results * `New.logDerivU`: the form `Φᴴ J dΦ` of a map `Φ` to `New.U J`; it is skew-hermitian (`New.conjTranspose_logDerivU`). * `New.HasGaussianIntegral.measurePreserving`, `New.HasGaussianIntegral.exists_measurePreserving_equiv`: a linear isomorphism that matches the forms of two volumes normalised by `New.HasGaussianIntegral` preserves measure. * `New.cayleyChart`: the chart y ↦ 2 (1 - X)⁻¹ - 1, X = J⁻¹ (`New.skewOfReal` y) / 2, which is (1 + X)(1 - X)⁻¹ where 1 - X is invertible; its density is `New.cayleyDensity`. * `New.haarU`, `New.lintegral_eq_cayleyChart`: the measure, and integrals against it in the chart. * `New.cayleyChart_jacobian`: the Jacobian of q ↦ a · cayleyChart J (y q) · b. * `New.measurePreserving_haarU`: maps g ↦ a g b of unitary groups, for suitable a and b, preserve `New.haarU`. It follows that `New.haarU` is a Haar measure. Notions from other files: * `New.skewOfReal`, `New.skewCoords`: real coordinates on skew-hermitian matrices: the imaginary parts of the diagonal entries, and orthonormal coordinates of one entry in each pair off it. * `New.HasGaussianIntegral a q`: the volume gives `exp (-t * q)` the integral `(π / t) ^ a` for all `t > 0`. ## Relation to the literature Part of a known result: the Haar measure of U(J) in Cayley coordinates. -/ noncomputable section namespace New /-! ## Skew coordinates, U(J) as a closed set, and determinants * `New.isClosedEmbedding_U`, `New.continuous_U_iff_matrix`: U(J) has the topology of a closed set of matrices. -/ section SkewCoordinates open Matrix LinearMap Algebra Fintype IsHermitianInvolution Topology variable {n : Type _} [Fintype n] [DecidableEq n] {J x : Matrix n n ℂ} [IsHermitianInvolution J] (y : Matrix n n ℝ) /-- For complex square matrices P of size m and Q of size n, the real-linear map X ↦ PXQ on complex m×n matrices has determinant |det P|^(2n)·|det Q|^(2m). -/ theorem det_mulLeft_mulRight_real {m : Type _} [Fintype m] [DecidableEq m] (P : Matrix m m ℂ) (Q : Matrix n n ℂ) : (mulRightLinearMap m ℝ Q ∘ₗ mulLeftLinearMap n ℝ P).det = ‖det P‖ ^ (2 * card n) * ‖(det Q : ℂ)‖ ^ (2 * card m) := by -- Over `ℂ` the map has matrix `P ⊗ Qᵀ` in the standard basis; its real determinant is the -- norm `|·|²` of the complex one. set T : Matrix m n ℂ →ₗ[ℂ] Matrix m n ℂ := mulRightLinearMap m ℂ Q ∘ₗ mulLeftLinearMap n ℂ P have h_matrix : toMatrix (stdBasis ℂ m n) (stdBasis ℂ m n) T = kronecker P Qᵀ := by simp [T, ← ext_iff, toMatrix_apply, stdBasis, mul_apply, Pi.single_apply, ite_apply] have h_det : T.det = P.det ^ card n * Q.det ^ card m := by rw [← det_toMatrix (stdBasis ℂ m n), h_matrix, kronecker, det_kronecker, det_transpose] exact T.det_restrictScalars.trans (by simp [h_det, norm_complex_eq, pow_mul, Complex.sq_norm]) /-- Let J be a hermitian involution. Every matrix x with xᴴ J x = J is the matrix of an element of U(J). -/ theorem exists_U_coe_eq (h_form : xᴴ * J * x = J) : ∃ g : U J, g = x := ⟨U.of isUnit x h_form, rfl⟩ /-- For a hermitian involution J, sending an element of U(J) to its matrix is a closed embedding. -/ lemma isClosedEmbedding_U : IsClosedEmbedding fun g : U J ↦ (g : Matrix n n ℂ) := U.isClosedEmbedding_coe isUnit /-- For a hermitian involution J, a map to U(J) is continuous if and only if it is continuous as a map to matrices. -/ theorem continuous_U_iff_matrix {X : Type*} [TopologicalSpace X] {f : X → U J} : Continuous f ↔ Continuous fun x : X ↦ (f x : Matrix n n ℂ) := isClosedEmbedding_U.continuous_iff section omit [Fintype n] /-- `skewCoords` reads the real coordinates y back from the skew-hermitian matrix `skewOfReal y`. -/ @[simp] theorem skewCoords_skewOfReal : skewCoords (skewOfReal y) = y := by ext a b obtain rfl | hab := eq_or_ne a b · simp [skewCoords, skewOfReal] · suffices ((y a b - y b a) / √2 + (y a b + y b a) / √2) / √2 = y a b by simpa [skewCoords, skewOfReal, hab] rw [← add_div, div_div, Real.mul_self_sqrt zero_le_two] ring /-- The matrix `skewOfReal y` with real coordinates y is skew-hermitian. -/ @[simp] theorem conjTranspose_skewOfReal : (skewOfReal y)ᴴ = -skewOfReal y := by ext a b obtain rfl | hab := eq_or_ne a b · simp [skewOfReal] ring · simp [skewOfReal, hab, hab.symm] ring /-- A skew-hermitian matrix x is recovered by `skewOfReal` from its real coordinates `skewCoords x`. -/ @[simp] lemma skewOfReal_skewCoords (hx : xᴴ = -x) : skewOfReal (skewCoords x) = x := by ext a b obtain ⟨h_re, h_im⟩ : (x b a).re = -(x a b).re ∧ (x b a).im = (x a b).im := by simpa [Complex.ext_iff] using (congr_fun₂ hx a b : star (x b a) = -x a b) obtain rfl | hab := eq_or_ne a b · simp [skewCoords, skewOfReal, Complex.ext_iff, show (x a a).re = 0 by linarith] · suffices (((x a b).re + (x a b).im) / √2 - ((x b a).re + (x b a).im) / √2) / √2 = (x a b).re ∧ (((x a b).re + (x a b).im) / √2 + ((x b a).re + (x b a).im) / √2) / √2 = (x a b).im by simpa [skewCoords, skewOfReal, Complex.ext_iff, hab, hab.symm] rw [h_re, h_im, ← sub_div, ← add_div, div_div, div_div, Real.mul_self_sqrt zero_le_two] constructor <;> ring end end SkewCoordinates /-! ## The logarithmic derivative, Jacobians of congruences, measure-preserving maps -/ section LogDerivative open Matrix MeasureTheory Module Real Complex LinearMap Fintype Norms.L2Operator IsHermitianInvolution variable {n : Type} [Fintype n] [DecidableEq n] {J : Matrix n n ℂ} {V W : Type _} [NormedAddCommGroup V] [NormedSpace ℝ V] [NormedAddCommGroup W] [NormedSpace ℝ W] (Φ : V → U J) (p : V) /-! ### The logarithmic derivative -/ /-- The condition that a map Φ from a real normed space to U(J), viewed as matrix-valued, is real differentiable at the point p. -/ abbrev DifferentiableAtU : Prop := DifferentiableAt ℝ (fun x : V ↦ (Φ x : Matrix n n ℂ)) p /-- For Φ : V → U(J), the real linear map v ↦ Φ(p)ᴴ J dΦ_p(v), that is the form Jg⁻¹dg pulled back by Φ at p. -/ noncomputable def logDerivU : V →ₗ[ℝ] Matrix n n ℂ := mulLeft ℝ ((Φ p : Matrix n n ℂ)ᴴ * J) ∘ₗ (fderiv ℝ (fun x : V ↦ (Φ x : Matrix n n ℂ)) p).toLinearMap variable {Φ p} [IsHermitianInvolution J] [FiniteDimensional ℝ W] /-- Let J be a hermitian involution and Φ : V → U(J) differentiable at p. Then the value Φ(p)ᴴ J dΦ_p(v) of `logDerivU Φ p` is skew-hermitian. -/ theorem conjTranspose_logDerivU (h_diff : DifferentiableAtU Φ p) (v : V) : (logDerivU Φ p v)ᴴ = -logDerivU Φ p v := by -- Differentiate the constant function `Φᴴ * J * Φ = J` by the product rule. let g (x : V) : Matrix n n ℂ := Φ x let D : Matrix n n ℂ := fderiv ℝ g p v have h_const : (fun x : V ↦ star (g x) * J * g x) = fun _ : V ↦ J := funext fun x ↦ mem_U.1 (Φ x).property have h_product : fderiv ℝ (fun x : V ↦ star (g x) * J * g x) p v = (g p)ᴴ * J * D + Dᴴ * J * g p := by rw [((h_diff.hasFDerivAt.star.mul_const' J).fun_mul' h_diff.hasFDerivAt).fderiv] simp [g, D, star] have h_deriv : (g p)ᴴ * J * D + Dᴴ * J * g p = 0 := by simp [← h_product, h_const] simpa [logDerivU, g, D, isHermitian.eq, mul_assoc, eq_neg_iff_add_eq_zero, add_comm] using h_deriv /-! ### Determinants -/ /-- Read real `n × n` matrices as skew-hermitian ones through `New.skewOfReal` and `New.skewCoords`. Let `e` identify them with `V`, and let `L` be a linear map from `V` to them. Following `L` by the congruence `S ↦ Cᴴ * S * C` multiplies `|det (e ∘ L)|` by `‖det C‖ ^ (2 n)`. -/ theorem abs_det_skew_congruence (e : Matrix n n ℝ ≃ₗ[ℝ] V) (C : Matrix n n ℂ) (L : V →ₗ[ℝ] Matrix n n ℝ) : |(e.toLinearMap ∘ₗ skewCoords ∘ₗ mulLeftRight ℝ (Cᴴ, C) ∘ₗ skewOfReal (n := n) ∘ₗ L).det| = ‖C.det‖ ^ (2 * card n) * |(e.toLinearMap ∘ₗ L).det| := by -- `T` is the congruence on skew-hermitian matrices. Every matrix is `s + I • s'` with `s`, `s'` -- skew-hermitian, so `X ↦ Cᴴ * X * C` is conjugate to `T × T` and its determinant is `det T ^ 2`. set T : End ℝ (Matrix n n ℝ) := skewCoords ∘ₗ mulLeftRight ℝ (Cᴴ, C) ∘ₗ skewOfReal have h_inj : Function.Injective ((skewOfReal (n := n)).coprod (I • skewOfReal)) := by refine (injective_iff_map_eq_zero _).2 fun ⟨s, s'⟩ hs ↦ ?_ replace hs : skewOfReal s + I • skewOfReal s' = 0 := by simpa using hs have hs_star : -skewOfReal s + I • skewOfReal s' = 0 := by simpa using congrArg conjTranspose hs have hs_zero : skewOfReal s = 0 := by linear_combination (norm := module) (2⁻¹ : ℂ) • hs - (2⁻¹ : ℂ) • hs_star have hs'_zero : skewOfReal s' = 0 := by simpa [hs_zero] using hs exact Prod.ext (by simpa using congrArg skewCoords hs_zero) (by simpa using congrArg skewCoords hs'_zero) let φ : (Matrix n n ℝ × Matrix n n ℝ) ≃ₗ[ℝ] Matrix n n ℂ := linearEquivOfInjective _ h_inj (by simp +arith [finrank_matrix]) set M : End ℝ (Matrix n n ℂ) := mulRightLinearMap n ℝ C ∘ₗ mulLeftLinearMap n ℝ Cᴴ have h_conj : φ.toLinearMap ∘ₗ T.prodMap T ∘ₗ φ.symm.toLinearMap = M := by rw [← LinearMap.comp_assoc, LinearEquiv.comp_toLinearMap_symm_eq] simp [φ, T, M, skewOfReal_skewCoords, mul_add, conjTranspose_skewOfReal, mul_assoc, add_mul, DFunLike.ext_iff] -- `X ↦ Cᴴ * X * C` has real determinant `‖det Cᴴ‖ ^ (2 n) * ‖det C‖ ^ (2 n)`. have h_det_sq : T.det * T.det = (‖C.det‖ ^ (2 * card n)) ^ 2 := by rw [← det_prodMap, ← LinearMap.det_conj _ φ, h_conj, det_mulLeft_mulRight_real Cᴴ C] simp [pow_two] have h_factor : e.toLinearMap ∘ₗ skewCoords ∘ₗ mulLeftRight ℝ (Cᴴ, C) ∘ₗ skewOfReal ∘ₗ L = (e.toLinearMap ∘ₗ T ∘ₗ e.symm.toLinearMap) * (e.toLinearMap ∘ₗ L) := by simp [T, DFunLike.ext_iff] rw [h_factor, map_mul, abs_mul, LinearMap.det_conj T e, ← sqrt_mul_self_eq_abs, h_det_sq, sqrt_sq (by positivity)] /-- The determinant of a block lower triangular map `T` of `V × W` is the product of the determinants of its diagonal blocks: `A` gives the first component of `T (v, w)` from `v` alone, and `B` gives the second component of `T (0, w)`. -/ theorem Haar.det_eq_mul_of_fst_eq_of_snd_eq [FiniteDimensional ℝ V] {T : End ℝ (V × W)} (A : End ℝ V) (B : End ℝ W) (hA : ∀ v : V × W, (T v).1 = A v.1) (hB : ∀ w : W, (T (0, w)).2 = B w) : T.det = A.det * B.det := by -- In a product basis the matrix of `T` is block lower triangular with diagonal blocks `A`, `B`. let bV := finBasis ℝ V let bW := finBasis ℝ W have h_blocks : toMatrix (bV.prod bW) (bV.prod bW) T = fromBlocks (toMatrix bV bV A) 0 (toMatrix bV bW (snd ℝ V W ∘ₗ T ∘ₗ inl ℝ V W)) (toMatrix bW bW B) := by simp [← ext_iff, toMatrix_apply, hA, hB] simp [← det_toMatrix (bV.prod bW), h_blocks] variable [FiniteDimensional ℝ V] variable [MeasureSpace V] [BorelSpace V] [(volume (α := V)).IsAddHaarMeasure] [MeasureSpace W] [BorelSpace W] [(volume (α := W)).IsAddHaarMeasure] {a b : ℝ} {q : V → ℝ} {q' : W → ℝ} [h_gauss : HasGaussianIntegral (V := V) a q] /-- If the volumes of two finite-dimensional real spaces are additive Haar measures, then so is their product. -/ instance : (volume (α := V × W)).IsAddHaarMeasure := Measure.prod.instIsAddHaarMeasure (volume : Measure V) (volume : Measure W) /-- If the volume on V is Gaussian-normalised for q with exponent a, then the volume on m × n matrices over V is so for the sum of q over the entries, with exponent a n m. -/ instance {m : Type} [Fintype m] : HasGaussianIntegral (V := Matrix m n V) (a * card n * card m) fun x : Matrix m n V ↦ ∑ i : m, ∑ j : n, q (x i j) := h_gauss.pi.pi /-! ### The scalar circle, and volumes normalised by a Gaussian -/ /-- For real t, the scalar matrix e^{it}·1 as an element of U(J). -/ noncomputable def circleScalar (t : ℝ) : U J := U.of isUnit (Complex.exp (t * I) • 1) (by simp [smul_smul, mul_conj']) include h_gauss omit [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] [BorelSpace V] [(volume (α := V)).IsAddHaarMeasure] in /-- If the volume on V is Gaussian-normalised for q (`HasGaussianIntegral a q`), then exp(-π q) has lower integral 1. -/ theorem lintegral_gaussian_eq_one : ∫⁻ x : V, ‖rexp (-π * q x)‖ₑ = 1 := by -- The Gaussian is integrable because its integral is `1 ≠ 0`, and it equals its norm. have h_one : ∫ x, rexp (-π * q x) = 1 := by simpa using h_gauss.integral_exp_eq pi_pos rw [← ofReal_integral_norm_eq_lintegral_enorm (.of_integral_ne_zero (h_one.trans_ne one_ne_zero))] simpa using h_one /-- Suppose `∫ exp (-t q) = (π / t) ^ a` on `V` and `∫ exp (-t q') = (π / t) ^ b` on `W` for all `t > 0` (`HasGaussianIntegral`). A linear isomorphism `e` with `q' ∘ e = q` preserves the volume. -/ theorem HasGaussianIntegral.measurePreserving (e : V ≃ₗ[ℝ] W) [h_gauss' : HasGaussianIntegral b q'] (he : ∀ x : V, q' (e x) = q x) : MeasurePreserving e := by -- The image of the volume under `e` is invariant and gives the Gaussian of `q'` the integral `1`, -- so it is the volume of `W` by the uniqueness of Haar measure. have h_emb : Topology.IsClosedEmbedding e.toLinearMap := isClosedEmbedding_of_injective e.ker refine ⟨h_emb.measurable, addHaar_eq_of_integral_eq_one (f := fun y ↦ rexp (-π * q' y)) ?_ ?_⟩ · simpa using h_gauss'.integral_exp_eq pi_pos · exact (h_emb.integral_map _).trans (by simpa [he] using h_gauss.integral_exp_eq pi_pos) /-- Suppose `∫ exp (-t q) = (π / t) ^ a` on `V` for all `t > 0` (`HasGaussianIntegral a q`), and `V` has the dimension of the real `n × n` matrices. A linear map `f` from these matrices to `V` with `q (f y) = ∑ i, ∑ j, y i j ^ 2` is invertible, and its inverse preserves the volume. -/ theorem HasGaussianIntegral.exists_measurePreserving_equiv (f : Matrix n n ℝ →ₗ[ℝ] V) (hf : ∀ y : Matrix n n ℝ, q (f y) = ∑ i : n, ∑ j : n, y i j ^ 2) (h_rank : finrank ℝ (Matrix n n ℝ) = finrank ℝ V) : ∃ e : V ≃ₗ[ℝ] Matrix n n ℝ, MeasurePreserving e ∧ ⇑e.symm = f := by -- If `f y = 0`, then `∑ y i j ^ 2 = q 0 = q (f 0) = 0`. have f_inj : Function.Injective f := by refine (injective_iff_map_eq_zero _).2 fun y hy ↦ ext ?_ have h_sum : ∑ i : n, ∑ j : n, y i j ^ 2 = 0 := by simpa [← hy, hf] using hf 0 simpa [Finset.sum_eq_zero_iff_of_nonneg, Finset.sum_nonneg, sq_nonneg] using h_sum let e : Matrix n n ℝ ≃ₗ[ℝ] V := f.linearEquivOfInjective f_inj h_rank exact ⟨e.symm, measurePreserving _ fun x ↦ (hf (e.symm x)).symm.trans (congrArg q (e.apply_symm_apply x)), rfl⟩ end LogDerivative /-! ## The Cayley chart and the Haar measure on U(J) * `New.Haar.lintegral_chart_rotate_le`: an injective parametrisation, rotated by a generic scalar, integrates to at most the full integral. No chart is assumed to cover almost all of U(J). Instead, rotating by a generic scalar e^{it} moves almost all points of any parametrisation into the Cayley chart. -/ section CompactDualMeasure open Matrix MeasureTheory Measure Set IsHermitianInvolution Norms.L2Operator ComplexOrder Fintype Haar section variable {n : Type} [Fintype n] [DecidableEq n] (J J' : Matrix n n ℂ) [IsHermitianInvolution J] (y : Matrix n n ℝ) /-- The matrix 1 − ½J⁻¹Y, where Y is the skew-hermitian matrix `New.skewOfReal` y attached to the real matrix y; the denominator in Cayley's chart. -/ def cayleyDenom : Matrix n n ℂ := 1 - (2⁻¹ : ℂ) • (J⁻¹ * skewOfReal y) /-- The matrix 2 D⁻¹ - 1, D = `New.cayleyDenom` J y, preserves the form of the hermitian involution J, also where D is singular. -/ theorem gram_two_smul_inv_cayleyDenom_sub_one : ((2 : ℂ) • (cayleyDenom J y)⁻¹ - 1)ᴴ * J * ((2 : ℂ) • (cayleyDenom J y)⁻¹ - 1) = J := by -- If `D` is singular then `D⁻¹ = 0` and the matrix is `-1`. Otherwise `M = D⁻¹` satisfies -- `Mᴴ J + J M = 2 Mᴴ J M`, because `J D + Dᴴ J = 2 J`. set D : Matrix n n ℂ := cayleyDenom J y with hD obtain ⟨-, h_inv⟩ | h_zero := D.nonsing_inv_cancel_or_zero · have h_JD : J * D = J - (2⁻¹ : ℂ) • skewOfReal y := by simp [hD, cayleyDenom, inv_eq_right_inv (IsHermitianInvolution.mul_self (J := J)), Matrix.mul_sub, ← Matrix.mul_assoc, IsHermitianInvolution.mul_self] have h_sum : J * D + Dᴴ * J = (2 : ℂ) • J := by rw [show Dᴴ * J = (J * D)ᴴ by simp [isHermitian.eq], h_JD] simp [isHermitian.eq] module have h_inv_sum : D⁻¹ᴴ * J + J * D⁻¹ = (2 : ℂ) • (D⁻¹ᴴ * J * D⁻¹) := calc _ = D⁻¹ᴴ * J * (D * D⁻¹) + (D * D⁻¹)ᴴ * J * D⁻¹ := by simp [h_inv] _ = D⁻¹ᴴ * (J * D + Dᴴ * J) * D⁻¹ := by simp [Matrix.mul_add, Matrix.add_mul, mul_assoc] _ = _ := by simp [h_sum] calc _ = (2 : ℂ) • ((2 : ℂ) • (D⁻¹ᴴ * J * D⁻¹) - (D⁻¹ᴴ * J + J * D⁻¹)) + J := by simp [Matrix.mul_sub, Matrix.sub_mul] module _ = J := by simp [h_inv_sum] · simp [h_zero] attribute [local simp] cayleyDenom in /-- The Cayley chart. Put X = J⁻¹ (`New.skewOfReal` y) / 2, so that `New.cayleyDenom` J y = 1 - X. This is the element of U(J) with matrix 2 (1 - X)⁻¹ - 1, which equals the Cayley transform (1 + X)(1 - X)⁻¹ when 1 - X is invertible. For a hermitian involution J this matrix always lies in U(J). Where 1 - X is singular, Mathlib's inverse is 0 and the value is -1. -/ @[simps! -isSimp coe_val] def cayleyChart : U J := U.of IsHermitianInvolution.isUnit ((2 : ℂ) • (cayleyDenom J y)⁻¹ - 1) (by simpa using gram_two_smul_inv_cayleyDenom_sub_one J y) /-- The real number (|det J| · |det(1 − ½J⁻¹S)|²)^(−N), where S = `New.skewOfReal` y is the skew-hermitian matrix with coordinates y and N = card n. It is the Jacobian of the Cayley chart. -/ abbrev cayleyDensity : ℝ := ((‖J.det‖ * ‖(cayleyDenom J y).det‖ ^ 2) ^ card n)⁻¹ /-- The number 2π^k r^{k−1}/(k−1)!; for k ≥ 1 the sphere of radius ρ in ℂ^k has area ρ times its value at r = ρ². -/ @[simp] abbrev sphereDensity (k : ℕ) (r : ℝ) : ℝ := 2 * Real.pi ^ k / (k - 1).factorial * r ^ (k - 1) /-- The number ∏_{i