File size: 7,063 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import OAI.Analysis.Calculus.Current.Wave

namespace OAI.Analysis.Calculus.Current

noncomputable section

def realQCLM : ℝ β†’L[ℝ] Quaternion ℝ := (ContinuousLinearMap.id ℝ ℝ).smulRight 1

def complexKCLM : β„‚ β†’L[ℝ] Quaternion ℝ :=
  Complex.reCLM.smulRight 1 + Complex.imCLM.smulRight (complexK Complex.I)

theorem realQCLM_apply (r : ℝ) : realQCLM r = (r : Quaternion ℝ) := by
  ext <;> simp [realQCLM]

theorem complexKCLM_apply (c : β„‚) : complexKCLM c = complexK c := by
  ext <;> simp [complexKCLM, complexK]

theorem contDiff_complexK : ContDiff ℝ ⊀ (fun c : β„‚ => complexK c) := by
  have heq : (fun c : β„‚ => complexK c) = complexKCLM :=
    funext (fun c => (complexKCLM_apply c).symm)
  rw [heq]
  exact complexKCLM.contDiff

def quaternionReCLM : Quaternion ℝ β†’L[ℝ] ℝ :=
  { QuaternionAlgebra.reβ‚— (-1 : ℝ) 0 (-1) with cont := Quaternion.continuous_re }

theorem contDiff_starQ : ContDiff ℝ ⊀ (star : Quaternion ℝ β†’ Quaternion ℝ) := by
  have hr : ContDiff ℝ ⊀ (fun q : Quaternion ℝ => (q.re : Quaternion ℝ)) := by
    convert realQCLM.contDiff.comp quaternionReCLM.contDiff using 1
    funext q
    exact (realQCLM_apply _).symm
  convert (hr.add hr).sub contDiff_id using 1
  funext q
  ext <;> simp

theorem contDiff_movingEmbed :
    ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => movingEmbed p.1 p.2) := by
  have he : ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => complexK p.1) :=
    contDiff_complexK.comp contDiff_fst
  have hr : ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => (p.2.re : Quaternion ℝ)) := by
    have hp : ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => p.2.re) :=
      Complex.reCLM.contDiff.comp (contDiff_snd : ContDiff ℝ ⊀ (Prod.snd : β„‚ Γ— β„‚ β†’ β„‚))
    convert realQCLM.contDiff.comp hp using 1
    funext p
    exact (realQCLM_apply _).symm
  have hi : ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => (p.2.im : Quaternion ℝ)) := by
    have hp : ContDiff ℝ ⊀ (fun p : β„‚ Γ— β„‚ => p.2.im) :=
      Complex.imCLM.contDiff.comp (contDiff_snd : ContDiff ℝ ⊀ (Prod.snd : β„‚ Γ— β„‚ β†’ β„‚))
    convert realQCLM.contDiff.comp hp using 1
    funext p
    exact (realQCLM_apply _).symm
  exact hr.add ((he.mul contDiff_const).mul hi)

theorem contDiffAt_ratio {d : β„•} (z : Index d β†’ β„‚) (hY : z none β‰  0) (i : Fin d) :
    ContDiffAt ℝ ⊀ (fun w => ratio w i) z := by
  unfold ratio
  simp only [div_eq_mul_inv]
  fun_prop (disch := assumption)

theorem contDiffAt_movingUnit {d : β„•} (z : Index d β†’ β„‚) (hY : z none β‰  0) :
    ContDiffAt ℝ ⊀ (movingUnit (d := d)) z := by
  have hy : ContDiffAt ℝ ⊀ (fun w : Index d β†’ β„‚ => β€–w noneβ€–) z :=
    (contDiffAt_apply ℝ β„‚ none z).norm β„‚ hY
  have hC : ContDiffAt ℝ ⊀ (fun w : Index d β†’ β„‚ => (β€–w noneβ€– : β„‚)) z :=
    Complex.ofRealCLM.contDiff.contDiffAt.comp z hy
  have hn : (β€–z noneβ€– : β„‚) β‰  0 := by exact_mod_cast norm_ne_zero_iff.mpr hY
  change ContDiffAt ℝ ⊀ (fun w : Index d β†’ β„‚ => w none / (β€–w noneβ€– : β„‚)) z
  simpa only [div_eq_mul_inv] using
    (contDiffAt_apply ℝ β„‚ none z).mul (hC.fun_inv hn)

theorem contDiffAt_modeEnvelope {d : β„•} (ΞΊ : ℝ) (v : Fin d β†’ ℝ)
    (z : Index d β†’ β„‚) (hY : z none β‰  0) :
    ContDiffAt ℝ ⊀ (modeEnvelope ΞΊ v) z := by
  have hy : ContDiffAt ℝ ⊀ (fun w : Index d β†’ β„‚ => β€–w noneβ€–) z :=
    (contDiffAt_apply ℝ β„‚ none z).norm β„‚ hY
  have hn : β€–z noneβ€– β‰  0 := norm_ne_zero_iff.mpr hY
  have hd : ContDiffAt ℝ ⊀ (fun w => squaredDistance (ratio w) v) z := by
    apply ContDiffAt.sum
    intro i _
    exact ((contDiffAt_ratio z hY i).sub contDiffAt_const).norm_sq β„‚
  unfold modeEnvelope
  fun_prop (disch := assumption)

theorem contDiff_phaseComplex {d : β„•} (cR cI : ℝ) (L : Index d β†’ ℝ) :
    ContDiff ℝ ⊀ (phaseComplex cR cI L) := by
  have hF : ContDiff ℝ ⊀ (phaseF cR cI L) := by unfold phaseF phaseArgument; fun_prop
  have hG : ContDiff ℝ ⊀ (phaseG cR cI L) := by unfold phaseG phaseArgument; fun_prop
  have heq : phaseComplex cR cI L =
      (fun x => (phaseF cR cI L x : β„‚) + Complex.I * (phaseG cR cI L x : β„‚)) := by
    funext x
    apply Complex.ext <;> simp [phaseComplex]
  rw [heq]
  exact (Complex.ofRealCLM.contDiff.comp hF).add
    (contDiff_const.mul (Complex.ofRealCLM.contDiff.comp hG))

theorem contDiffAt_modeAmplitude {d : β„•} (ΞΊ cR cI : ℝ) (v : Fin d β†’ ℝ)
    (x : Index d β†’ ℝ) (z : Index d β†’ β„‚) (hY : z none β‰  0) :
    ContDiffAt ℝ ⊀ (fun p : (Index d β†’ ℝ) Γ— (Index d β†’ β„‚) => modeAmplitude ΞΊ cR cI v p.1 p.2)
      (x, z) := by
  have he := (contDiffAt_movingUnit z hY).comp (x, z) contDiffAt_snd
  have hn := (contDiffAt_modeEnvelope ΞΊ v z hY).comp (x, z) contDiffAt_snd
  have hp := (contDiff_phaseComplex cR cI (modeCovector ΞΊ v)).contDiffAt.comp (x, z) contDiffAt_fst
  have hnc := Complex.ofRealCLM.contDiff.contDiffAt.comp (x, z) hn
  exact contDiff_movingEmbed.contDiffAt.comp (x, z) (he.prodMk (hnc.mul hp))

theorem contDiffAt_tangentField {d : β„•} (v : Fin d β†’ ℝ)
    (z : Index d β†’ β„‚) (hY : z none β‰  0) (a : Index d) :
    ContDiffAt ℝ ⊀ (fun w => tangentField v w a) z := by
  have hr := contDiffAt_ratio z hY
  cases a with
  | none => exact contDiffAt_const
  | some a =>
    cases a with
    | none =>
      change ContDiffAt ℝ ⊀ (fun w => -(βˆ‘ i, ratio w i * (v i : β„‚)) / 2) z
      fun_prop
    | some i =>
      change ContDiffAt ℝ ⊀ (fun w => ((v i : β„‚) + ratio w i) / 2) z
      fun_prop

/-- Joint smoothness in all real and imaginary coordinates on `Y β‰  0`. -/
theorem contDiffAt_modeCurrent {d : β„•} {ΞΉ : Type*} [Fintype ΞΉ]
    (ΞΊ cR cI : ΞΉ β†’ ℝ) (v : ΞΉ β†’ Fin d β†’ ℝ) (x : Index d β†’ ℝ) (z : Index d β†’ β„‚)
    (hY : z none β‰  0) (a b : Index d) :
    ContDiffAt ℝ ⊀ (fun p : (Index d β†’ ℝ) Γ— (Index d β†’ β„‚) => modeCurrent ΞΊ cR cI v p.1 p.2 a b)
      (x, z) := by
  have hΟ‡ (a : Index d) : ContDiffAt ℝ ⊀
      (fun p : (Index d β†’ ℝ) Γ— (Index d β†’ β„‚) =>
        currentColumn (ratio p.2) (fun j i => (v j i : β„‚))
          (fun j => modeAmplitude (ΞΊ j) (cR j) (cI j) (v j) p.1 p.2) a) (x, z) := by
    apply ContDiffAt.sum
    intro j _
    have hV := (contDiffAt_tangentField (v j) z hY a).comp (x, z) contDiffAt_snd
    exact (contDiff_complexK.contDiffAt.comp (x, z) hV).mul
      (contDiff_starQ.contDiffAt.comp (x, z)
        (contDiffAt_modeAmplitude (ΞΊ j) (cR j) (cI j) (v j) x z hY))
  exact (hχ a).mul (contDiff_starQ.contDiffAt.comp (x, z) (hχ b))

theorem contDiffAt_waveCurrent {d : β„•} {ΞΉ : Type*} [Fintype ΞΉ]
    (ΞΊ cR cI : ΞΉ β†’ ℝ) (v : ΞΉ β†’ Fin d β†’ ℝ) (x : Index d β†’ ℝ) (z : Index d β†’ β„‚)
    (hY : z none β‰  0) (a b : Index d) :
    ContDiffAt ℝ ⊀ (fun p : (Index d β†’ ℝ) Γ— (Index d β†’ β„‚) => waveCurrent ΞΊ cR cI v p.1 p.2 a b)
      (x, z) :=
  contDiffAt_modeCurrent ΞΊ
    (fun j => frequencyNormalization d (ΞΊ j) * cR j)
    (fun j => frequencyNormalization d (ΞΊ j) * cI j) v x z hY a b

end
end OAI.Analysis.Calculus.Current