Download data/lean/OAI/LinearAlgebra/Moore/Rank/One.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.72 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/Moore/Rank/One.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/Moore/Rank/One.lean
-
curl -L -o One.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/Moore/Rank/One.lean
8.72 kB
| import OAI.LinearAlgebra.Moore.Basic | |
| import OAI.Analysis.PDE.Energy.Algebra | |
| /-! Rank-one affineness of the signed quaternionic determinant polynomial. -/ | |
| namespace OAI.LinearAlgebra.Moore | |
| open Matrix | |
| /-- A product is affine in a perturbation supported at at most one factor. -/ | |
| theorem prod_affine_of_sparse {I R : Type*} [Fintype I] [DecidableEq I] | |
| [CommRing R] (f g : I β R) | |
| (hg : β i j, i β j β g i = 0 β¨ g j = 0) (t : R) : | |
| (β i, (f i + t * g i)) = | |
| (β i, f i) + t * ((β i, (f i + g i)) - β i, f i) := by | |
| classical | |
| by_cases hz : β i, g i = 0 | |
| Β· simp [hz] | |
| Β· obtain β¨k, hkβ© := not_forall.mp hz | |
| have hzero (i : I) (hi : i β k) : g i = 0 := (hg i k hi).resolve_right hk | |
| have hp (s : R) : (β i, (f i + s * g i)) = | |
| (f k + s * g k) * β i β Finset.univ.erase k, f i := by | |
| rw [β Finset.mul_prod_erase _ _ (Finset.mem_univ k)] | |
| congr 1 | |
| apply Finset.prod_congr rfl | |
| intro i hi | |
| rw [hzero i (Finset.ne_of_mem_erase hi), mul_zero, add_zero] | |
| have hbase : (β i, f i) = f k * β i β Finset.univ.erase k, f i := | |
| (Finset.mul_prod_erase _ _ (Finset.mem_univ k)).symm | |
| have hone := hp 1 | |
| simp only [one_mul] at hone | |
| rw [hp, hone, hbase] | |
| ring | |
| /-- The skew matrix corresponding to a real unit diagonal quaternionic entry. -/ | |
| def pairedPerturbation (n : β) (k : Fin n) : | |
| Matrix (Fin n Γ Fin 2) (Fin n Γ Fin 2) β := | |
| fun i j => if i = (k, 0) β§ j = (k, 1) then 1 | |
| else if i = (k, 1) β§ j = (k, 0) then -1 else 0 | |
| theorem pairedPerturbation_support (n : β) (k : Fin n) | |
| (i j : Fin n Γ Fin 2) (h : pairedPerturbation n k i j β 0) : | |
| i = (k, 0) β¨ j = (k, 0) := by | |
| by_contra hh | |
| simp only [not_or] at hh | |
| simp [pairedPerturbation, hh.1, hh.2] at h | |
| theorem pairedPerturbation_sparse (n : β) (k : Fin n) | |
| (Ο : Equiv.Perm (Fin n Γ Fin 2)) (i j : Fin n) (hij : i β j) : | |
| pairedPerturbation n k (Ο (i, 0)) (Ο (i, 1)) = 0 β¨ | |
| pairedPerturbation n k (Ο (j, 0)) (Ο (j, 1)) = 0 := by | |
| by_contra hh | |
| simp only [not_or] at hh | |
| have hi := pairedPerturbation_support n k _ _ hh.1 | |
| have hj := pairedPerturbation_support n k _ _ hh.2 | |
| rcases hi with hi | hi <;> rcases hj with hj | hj | |
| all_goals | |
| have he := Ο.injective (hi.trans hj.symm) | |
| exact hij (congrArg Prod.fst he) | |
| /-- Affine dependence of the Pfaffian on one distinguished skew pair. -/ | |
| theorem pfaffian_add_paired (n : β) | |
| (M : Matrix (Fin n Γ Fin 2) (Fin n Γ Fin 2) β) (k : Fin n) (t : β) : | |
| pfaffian n (M + t β’ pairedPerturbation n k) = | |
| pfaffian n M + t * (pfaffian n (M + pairedPerturbation n k) - pfaffian n M) := by | |
| unfold pfaffian | |
| simp only [Matrix.add_apply, Matrix.smul_apply, smul_eq_mul] | |
| simp_rw [prod_affine_of_sparse _ _ (pairedPerturbation_sparse n k _)] | |
| simp only [mul_add, mul_sub, Finset.sum_add_distrib, Finset.sum_sub_distrib] | |
| simp_rw [mul_left_comm _ t] | |
| rw [β Finset.mul_sum, β Finset.mul_sum] | |
| ring | |
| /-- Unit quaternionic rank-one diagonal projector. -/ | |
| def coordinateProjector (n : β) (k : Fin n) : Matrix (Fin n) (Fin n) (Quaternion β) := | |
| fun i j => if i = k β§ j = k then 1 else 0 | |
| theorem skewComplexify_coordinateProjector (n : β) (k : Fin n) : | |
| skewComplexify (coordinateProjector n k) = pairedPerturbation n k := by | |
| ext β¨i, aβ© β¨j, bβ© | |
| by_cases hi : i = k <;> by_cases hj : j = k <;> | |
| fin_cases a <;> fin_cases b <;> | |
| simp [coordinateProjector, pairedPerturbation, skewComplexify, skewQuaternion, | |
| quaternionMatrix, symplecticUnit, Matrix.mul_apply, Fin.sum_univ_two, hi, hj] <;> rfl | |
| theorem skewComplexify_add {I : Type*} (A B : Matrix I I (Quaternion β)) : | |
| skewComplexify (A + B) = skewComplexify A + skewComplexify B := by | |
| ext β¨i, aβ© β¨j, bβ© | |
| change ((quaternionMatrix (A i j + B i j)) * symplecticUnit) a b = _ | |
| rw [quaternionMatrix_add, Matrix.add_mul] | |
| rfl | |
| theorem skewComplexify_real_smul {I : Type*} (A : Matrix I I (Quaternion β)) (s : β) : | |
| skewComplexify (s β’ A) = (s : β) β’ skewComplexify A := by | |
| ext β¨i, aβ© β¨j, bβ© | |
| exact congrArg (fun M : Matrix (Fin 2) (Fin 2) β => M a b) | |
| (skewQuaternion_smul s (A i j)) | |
| /-- The signed Moore determinant is affine in each real diagonal coordinate. -/ | |
| theorem mooreDet_add_coordinate (n : β) (A : Matrix (Fin n) (Fin n) (Quaternion β)) | |
| (k : Fin n) (t : β) : | |
| mooreDet n (A + t β’ coordinateProjector n k) = | |
| mooreDet n A + t * (mooreDet n (A + coordinateProjector n k) - mooreDet n A) := by | |
| unfold mooreDet | |
| rw [skewComplexify_add, skewComplexify_real_smul, skewComplexify_coordinateProjector, | |
| pfaffian_add_paired] | |
| rw [skewComplexify_add, skewComplexify_coordinateProjector] | |
| simp | |
| theorem pfaffian_paired_zero (n : β) (k : Fin (n + 2)) : | |
| pfaffian (n + 2) (pairedPerturbation (n + 2) k) = 0 := by | |
| have hp (Ο : Equiv.Perm (Fin (n + 2) Γ Fin 2)) : | |
| (β i : Fin (n + 2), pairedPerturbation (n + 2) k (Ο (i, 0)) (Ο (i, 1))) = 0 := by | |
| rcases pairedPerturbation_sparse (n + 2) k Ο 0 1 (by simp) with h | h | |
| Β· exact Finset.prod_eq_zero (Finset.mem_univ 0) h | |
| Β· exact Finset.prod_eq_zero (Finset.mem_univ 1) h | |
| simp [pfaffian, hp] | |
| theorem mooreDet_coordinateProjector_zero (n : β) (k : Fin (n + 2)) : | |
| mooreDet (n + 2) (coordinateProjector (n + 2) k) = 0 := by | |
| rw [mooreDet, skewComplexify_coordinateProjector, pfaffian_paired_zero] | |
| rfl | |
| /-- Exact two-parameter rank-one formula, valid in arbitrary quaternionic dimension | |
| at least two, for the signed Moore polynomial. -/ | |
| theorem mooreDet_rankOne_pencil (n : β) | |
| (A : Matrix (Fin (n + 2)) (Fin (n + 2)) (Quaternion β)) | |
| (k : Fin (n + 2)) (t s : β) : | |
| mooreDet (n + 2) (t β’ A + s β’ coordinateProjector (n + 2) k) = | |
| t ^ (n + 2) * mooreDet (n + 2) A + | |
| s * t ^ (n + 1) * | |
| (mooreDet (n + 2) (A + coordinateProjector (n + 2) k) - mooreDet (n + 2) A) := by | |
| by_cases ht : t = 0 | |
| Β· simp [ht, mooreDet_smul, mooreDet_coordinateProjector_zero] | |
| Β· have hm : t β’ A + s β’ coordinateProjector (n + 2) k = | |
| t β’ (A + (s / t) β’ coordinateProjector (n + 2) k) := by | |
| rw [smul_add, smul_smul] | |
| congr 1 | |
| rw [mul_div_cancelβ s ht] | |
| rw [hm, mooreDet_smul, mooreDet_add_coordinate] | |
| have hpow : t ^ (n + 2) = t ^ (n + 1) * t := pow_succ t (n + 1) | |
| rw [hpow] | |
| field_simp | |
| /-- The determinant polynomial on the time-projector segment has only its | |
| top two powers, with the correct signed cofactor coefficient. -/ | |
| theorem mooreDet_rankOne_segment (n : β) | |
| (A : Matrix (Fin (n + 2)) (Fin (n + 2)) (Quaternion β)) | |
| (k : Fin (n + 2)) (t : β) : | |
| mooreDet (n + 2) (t β’ A + (1 - t) β’ coordinateProjector (n + 2) k) = | |
| t ^ (n + 2) * mooreDet (n + 2) A + | |
| (1 - t) * t ^ (n + 1) * | |
| (mooreDet (n + 2) (A + coordinateProjector (n + 2) k) - mooreDet (n + 2) A) := | |
| mooreDet_rankOne_pencil n A k t (1 - t) | |
| /-- The diagonal cofactor is the genuine derivative of the Moore polynomial. -/ | |
| theorem hasDerivAt_mooreDet_coordinate (n : β) | |
| (A : Matrix (Fin n) (Fin n) (Quaternion β)) (k : Fin n) (t : β) : | |
| HasDerivAt (fun s : β => mooreDet n (A + s β’ coordinateProjector n k)) | |
| (mooreDet n (A + coordinateProjector n k) - mooreDet n A) t := by | |
| have hf : (fun s : β => mooreDet n (A + s β’ coordinateProjector n k)) = | |
| fun s => mooreDet n A + s * | |
| (mooreDet n (A + coordinateProjector n k) - mooreDet n A) := by | |
| funext s | |
| exact mooreDet_add_coordinate n A k s | |
| rw [hf] | |
| convert! ((hasDerivAt_id t).mul_const | |
| (mooreDet n (A + coordinateProjector n k) - mooreDet n A)).const_add | |
| (mooreDet n A) using 1 | |
| simp | |
| /-- Exact integral of the rank-one segment, the algebraic identity behind the | |
| determinant energy in `sections/energy.tex`. -/ | |
| theorem integral_mooreDet_rankOne_segment (n : β) | |
| (A : Matrix (Fin (n + 2)) (Fin (n + 2)) (Quaternion β)) | |
| (k : Fin (n + 2)) : | |
| (β« t in (0 : β)..1, | |
| mooreDet (n + 2) (t β’ A + (1 - t) β’ coordinateProjector (n + 2) k)) = | |
| mooreDet (n + 2) A / ((n : β) + 3) + | |
| (mooreDet (n + 2) (A + coordinateProjector (n + 2) k) - mooreDet (n + 2) A) / | |
| (((n : β) + 2) * ((n : β) + 3)) := by | |
| have hf : (fun t : β => | |
| mooreDet (n + 2) (t β’ A + (1 - t) β’ coordinateProjector (n + 2) k)) = | |
| fun t => t ^ ((n + 1) + 1) * mooreDet (n + 2) A + | |
| t ^ (n + 1) * (1 - t) * | |
| (mooreDet (n + 2) (A + coordinateProjector (n + 2) k) - mooreDet (n + 2) A) := by | |
| funext t | |
| rw [mooreDet_rankOne_segment] | |
| ring | |
| rw [hf, OAI.Analysis.PDE.Energy.integral_segment] | |
| norm_num [Nat.cast_add, Nat.cast_one] | |
| congr 2 <;> ring | |
| end OAI.LinearAlgebra.Moore | |