Download data/lean/OAI/LinearAlgebra/Moore/Derivative.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.44 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/Moore/Derivative.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/Moore/Derivative.lean
-
curl -L -o Derivative.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/Moore/Derivative.lean
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 | |