math / data /lean /OAI /LinearAlgebra /Moore /Derivative.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.44 kB
import OAI.LinearAlgebra.Moore.Rank.One
/-! The full first variation of the signed Moore determinant. -/
namespace OAI.LinearAlgebra.Moore
open Matrix
/-- Explicit differential of the Pfaffian polynomial. -/
noncomputable def pfaffianDifferential (n : β„•)
(M N : Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚) : β„‚ :=
(2 ^ n * (n.factorial : β„‚))⁻¹ *
βˆ‘ Οƒ : Equiv.Perm (Fin n Γ— Fin 2), ((Equiv.Perm.sign Οƒ : β„€) : β„‚) *
βˆ‘ i : Fin n, (∏ j ∈ Finset.univ.erase i, M (Οƒ (j, 0)) (Οƒ (j, 1))) *
N (Οƒ (i, 0)) (Οƒ (i, 1))
/-- The polynomial differential differentiates every entrywise differentiable
matrix path; the path parameter is real but the entries may be complex. -/
theorem hasDerivAt_pfaffian_path (n : β„•)
(M : ℝ β†’ Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚)
(N : Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚) (t : ℝ)
(h : βˆ€ i j, HasDerivAt (fun s => M s i j) (N i j) t) :
HasDerivAt (fun s => pfaffian n (M s)) (pfaffianDifferential n (M t) N) t := by
unfold pfaffian pfaffianDifferential
apply HasDerivAt.const_mul
apply HasDerivAt.fun_sum
intro Οƒ _
apply HasDerivAt.const_mul
simpa only [smul_eq_mul] using
(HasDerivAt.fun_finsetProd (u := Finset.univ)
(fun i _ => h (Οƒ (i, 0)) (Οƒ (i, 1))))
theorem pfaffianDifferential_add (n : β„•)
(M N P : Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚) :
pfaffianDifferential n M (N + P) =
pfaffianDifferential n M N + pfaffianDifferential n M P := by
simp [pfaffianDifferential, mul_add, Finset.sum_add_distrib]
theorem pfaffianDifferential_smul (n : β„•) (c : β„‚)
(M N : Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚) :
pfaffianDifferential n M (c β€’ N) = c * pfaffianDifferential n M N := by
have hg (a : β„‚) (f g : Fin n β†’ β„‚) :
a * (βˆ‘ i, f i * (c * g i)) = c * (a * βˆ‘ i, f i * g i) := by
simp only [Finset.mul_sum]
apply Finset.sum_congr rfl
intro i _
ring
simp only [pfaffianDifferential, Matrix.smul_apply, smul_eq_mul]
rw [mul_left_comm c]
congr 1
conv_rhs => rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro Οƒ _
exact hg _ _ _
/-- Euler's identity for the homogeneous degree-`n` Pfaffian polynomial. -/
theorem pfaffianDifferential_self (n : β„•)
(M : Matrix (Fin n Γ— Fin 2) (Fin n Γ— Fin 2) β„‚) :
pfaffianDifferential n M M = (n : β„‚) * pfaffian n M := by
have hp (Οƒ : Equiv.Perm (Fin n Γ— Fin 2)) (i : Fin n) :
(∏ j ∈ Finset.univ.erase i, M (Οƒ (j, 0)) (Οƒ (j, 1))) * M (Οƒ (i, 0)) (Οƒ (i, 1)) =
∏ j : Fin n, M (Οƒ (j, 0)) (Οƒ (j, 1)) :=
Finset.prod_erase_mul _ _ (Finset.mem_univ i)
simp only [pfaffianDifferential, hp, Finset.sum_const, Finset.card_univ,
Fintype.card_fin, nsmul_eq_mul, pfaffian]
simp_rw [mul_left_comm _ (n : β„‚), ← Finset.mul_sum]
ring
/-- Each scalar entry of the quaternion-to-skew representation is real-linear. -/
def skewQuaternionEntryLinear (a b : Fin 2) : Quaternion ℝ β†’β‚—[ℝ] β„‚ where
toFun q := skewQuaternion q a b
map_add' p q := by
unfold skewQuaternion
rw [quaternionMatrix_add, Matrix.add_mul]
rfl
map_smul' s q := by
have h := congrArg (fun M : Matrix (Fin 2) (Fin 2) β„‚ => M a b) (skewQuaternion_smul s q)
simpa only [Matrix.smul_apply, Complex.real_smul, smul_eq_mul, RingHom.id_apply] using h
noncomputable def skewQuaternionEntryCLM (a b : Fin 2) : Quaternion ℝ β†’L[ℝ] β„‚ :=
(skewQuaternionEntryLinear a b).toContinuousLinearMap
/-- Real differential of the signed Moore determinant. -/
noncomputable def mooreDifferential (n : β„•)
(A D : Matrix (Fin n) (Fin n) (Quaternion ℝ)) : ℝ :=
(pfaffianDifferential n (skewComplexify A) (skewComplexify D)).re
/-- Full quaternionic first variation along every entrywise differentiable path. -/
theorem hasDerivAt_mooreDet_path (n : β„•)
(A : ℝ β†’ Matrix (Fin n) (Fin n) (Quaternion ℝ))
(D : Matrix (Fin n) (Fin n) (Quaternion ℝ)) (t : ℝ)
(h : βˆ€ i j, HasDerivAt (fun s => A s i j) (D i j) t) :
HasDerivAt (fun s => mooreDet n (A s)) (mooreDifferential n (A t) D) t := by
have hsk : βˆ€ i j : Fin n Γ— Fin 2,
HasDerivAt (fun s => skewComplexify (A s) i j) (skewComplexify D i j) t := by
rintro ⟨i, a⟩ ⟨j, b⟩
exact (skewQuaternionEntryCLM a b).hasFDerivAt.comp_hasDerivAt t (h i j)
exact Complex.reCLM.hasFDerivAt.comp_hasDerivAt t
(hasDerivAt_pfaffian_path n (fun s => skewComplexify (A s)) (skewComplexify D) t hsk)
theorem mooreDifferential_add (n : β„•)
(A D E : Matrix (Fin n) (Fin n) (Quaternion ℝ)) :
mooreDifferential n A (D + E) = mooreDifferential n A D + mooreDifferential n A E := by
simp only [mooreDifferential, skewComplexify_add, pfaffianDifferential_add, Complex.add_re]
theorem mooreDifferential_smul (n : β„•) (c : ℝ)
(A D : Matrix (Fin n) (Fin n) (Quaternion ℝ)) :
mooreDifferential n A (c β€’ D) = c * mooreDifferential n A D := by
simp only [mooreDifferential, skewComplexify_real_smul, pfaffianDifferential_smul,
Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero]
/-- Euler contraction identity for the signed Moore determinant. -/
theorem mooreDifferential_self (n : β„•)
(A : Matrix (Fin n) (Fin n) (Quaternion ℝ)) :
mooreDifferential n A A = (n : ℝ) * mooreDet n A := by
rw [mooreDifferential, pfaffianDifferential_self, mooreDet]
simp
end OAI.LinearAlgebra.Moore