File size: 3,710 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import OAI.LinearAlgebra.Moore.Cofactor

/-! Smoothness of the signed determinant, its differential, and its cofactor,
including at singular matrices. -/

noncomputable section

namespace OAI.LinearAlgebra.Moore

open Matrix
open scoped ContDiff Matrix.Norms.Elementwise

theorem contDiff_skewComplexify_entry {n : β„•} (k : β„•βˆžΟ‰) (i j : Fin n Γ— Fin 2) :
    ContDiff ℝ k (fun A : Matrix (Fin n) (Fin n) (Quaternion ℝ) ↦ skewComplexify A i j) := by
  exact (skewQuaternionEntryCLM i.2 j.2).contDiff.comp
    (contDiff_apply_apply ℝ (Quaternion ℝ) i.1 j.1)

theorem contDiff_mooreDet (n : β„•) (k : β„•βˆžΟ‰) : ContDiff ℝ k (mooreDet n) := by
  change ContDiff ℝ k (Complex.reCLM ∘ fun A : Matrix (Fin n) (Fin n) (Quaternion ℝ) ↦
    pfaffian n (skewComplexify A))
  apply (Complex.reCLM.contDiff : ContDiff ℝ k Complex.reCLM).comp
  unfold pfaffian
  apply contDiff_const.mul
  apply ContDiff.sum
  intro Οƒ _
  apply contDiff_const.mul
  apply contDiff_prod
  intro i _
  exact contDiff_skewComplexify_entry k (Οƒ (i, 0)) (Οƒ (i, 1))

theorem contDiff_mooreDifferential_left (n : β„•) (k : β„•βˆžΟ‰)
    (D : Matrix (Fin n) (Fin n) (Quaternion ℝ)) :
    ContDiff ℝ k (fun A ↦ mooreDifferential n A D) := by
  change ContDiff ℝ k (Complex.reCLM ∘ fun A : Matrix (Fin n) (Fin n) (Quaternion ℝ) ↦
    pfaffianDifferential n (skewComplexify A) (skewComplexify D))
  apply (Complex.reCLM.contDiff : ContDiff ℝ k Complex.reCLM).comp
  unfold pfaffianDifferential
  apply contDiff_const.mul
  apply ContDiff.sum
  intro Οƒ _
  apply contDiff_const.mul
  apply ContDiff.sum
  intro i _
  apply ContDiff.mul _ contDiff_const
  apply contDiff_prod
  intro j _
  exact contDiff_skewComplexify_entry k (Οƒ (j, 0)) (Οƒ (j, 1))

theorem quaternionDualVector_eq (L : Quaternion ℝ β†’β‚—[ℝ] ℝ) :
    quaternionDualVector L = L 1 β€’ (1 : Quaternion ℝ) +
      L ⟨0, 1, 0, 0⟩ β€’ (⟨0, 1, 0, 0⟩ : Quaternion ℝ) +
      L ⟨0, 0, 1, 0⟩ β€’ (⟨0, 0, 1, 0⟩ : Quaternion ℝ) +
      L ⟨0, 0, 0, 1⟩ β€’ (⟨0, 0, 0, 1⟩ : Quaternion ℝ) := by
  ext <;> simp [quaternionDualVector]

theorem contDiff_rawCofactor (n : β„•) (k : β„•βˆžΟ‰) : ContDiff ℝ k (rawCofactor n) := by
  apply contDiff_pi.mpr
  intro i
  apply contDiff_pi.mpr
  intro j
  simp only [rawCofactor, quaternionDualVector_eq]
  apply quaternionStarCLM.contDiff.comp
  change ContDiff ℝ k (fun A ↦
    mooreDifferential n A (single j i 1) β€’ (1 : Quaternion ℝ) +
      mooreDifferential n A (single j i ⟨0, 1, 0, 0⟩) β€’ (⟨0, 1, 0, 0⟩ : Quaternion ℝ) +
      mooreDifferential n A (single j i ⟨0, 0, 1, 0⟩) β€’ (⟨0, 0, 1, 0⟩ : Quaternion ℝ) +
      mooreDifferential n A (single j i ⟨0, 0, 0, 1⟩) β€’ (⟨0, 0, 0, 1⟩ : Quaternion ℝ))
  exact (((contDiff_mooreDifferential_left n k _).smul contDiff_const).add
    ((contDiff_mooreDifferential_left n k _).smul contDiff_const) |>.add
    ((contDiff_mooreDifferential_left n k _).smul contDiff_const)).add
    ((contDiff_mooreDifferential_left n k _).smul contDiff_const)

theorem contDiff_mooreCofactor (n : β„•) (k : β„•βˆžΟ‰) : ContDiff ℝ k (mooreCofactor n) := by
  apply contDiff_pi.mpr
  intro i
  apply contDiff_pi.mpr
  intro j
  change ContDiff ℝ k (fun A ↦ (1 / 2 : ℝ) β€’
    (rawCofactor n A i j + star (rawCofactor n A j i)))
  have h₁ := (contDiff_pi.mp (contDiff_pi.mp (contDiff_rawCofactor n k) i)) j
  have hβ‚‚ := quaternionStarCLM.contDiff.comp
    ((contDiff_pi.mp (contDiff_pi.mp (contDiff_rawCofactor n k) j)) i)
  exact (contDiff_const : ContDiff ℝ k (fun _ : Matrix (Fin n) (Fin n) (Quaternion ℝ) ↦
    (1 / 2 : ℝ))).smul (h₁.add hβ‚‚)

end OAI.LinearAlgebra.Moore