File size: 9,919 Bytes
159357f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
import Mathlib
import OAI.Analysis.CoulombIonization.FormDomain.SobolevVector

namespace OAI

noncomputable section

open MeasureTheory Filter
open scoped Topology BigOperators ContDiff
open MeasureTheory Filter
open scoped Topology BigOperators ContDiff InnerProductSpace Convolution
open Filter
open scoped Topology InnerProductSpace
open MeasureTheory Complex Filter
open scoped Topology InnerProductSpace
open MeasureTheory Complex Filter
open scoped Topology InnerProductSpace ContDiff
open MeasureTheory Filter
open scoped Topology BigOperators ContDiff InnerProductSpace Convolution
open MeasureTheory Filter
open scoped Topology BigOperators ContDiff InnerProductSpace
open MeasureTheory Filter
open scoped Topology BigOperators ContDiff InnerProductSpace ENNReal
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open Set Filter Topology InnerProductSpace Laplacian
open MeasureTheory Filter
open scoped Topology
open MeasureTheory Filter
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter
open scoped Topology BigOperators InnerProductSpace
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter
open scoped Topology BigOperators Pointwise
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric Topology InnerProductSpace Laplacian
open scoped Convolution
open scoped RealInnerProductSpace
open MeasureTheory Filter Set Metric
open scoped Topology ENNReal
open MeasureTheory Filter Set Metric Topology InnerProductSpace Laplacian
open MeasureTheory Filter Set Metric Topology InnerProductSpace Laplacian
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Set Filter Metric Topology InnerProductSpace Laplacian
open MeasureTheory Set Filter Metric Topology InnerProductSpace Laplacian
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology InnerProductSpace Laplacian
open Filter Set Metric Topology InnerProductSpace Laplacian
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology
open Filter
open scoped Topology
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Filter Set Metric Topology
open MeasureTheory Complex Filter
open scoped Topology InnerProductSpace ContDiff BigOperators
open MeasureTheory Filter Set
open scoped Topology BigOperators
open MeasureTheory Filter
open scoped Topology BigOperators InnerProductSpace
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open scoped BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
open MeasureTheory Filter
open scoped Topology ContDiff BigOperators
namespace CoulombAtom

def sumForm {ι : Type*} [Fintype ι] {N : ℕ} (ψ : ι → FormVector N) : FormVector N where
  value s x := ∑ k, (ψ k).value s x
  gradient s i a x := ∑ k, (ψ k).gradient s i a x

lemma SobolevVector.sum {ι : Type*} [Fintype ι] {N : ℕ} {ψ : ι → FormVector N}
    (hψ : ∀ k, SobolevVector (ψ k)) : SobolevVector (sumForm ψ) := by
  classical
  refine ⟨fun s => memLp_finsetSum _ (fun k _ => (hψ k).1 s),
    fun s i a => memLp_finsetSum _ (fun k _ => (hψ k).2.1 s i a), ?_⟩
  intro s i a φ hφ hcφ
  change (∫ x, (∑ k, (ψ k).value s x) * Complex.ofReal (lineDeriv ℝ φ x (direction i a))) =
    -(∫ x, (∑ k, (ψ k).gradient s i a x) * (φ x : ℂ))
  simp only [Finset.sum_mul]
  rw [integral_finsetSum Finset.univ (fun k _ => show Integrable (fun x =>
      (ψ k).value s x * Complex.ofReal (lineDeriv ℝ φ x (direction i a))) from
      ((hψ k).1 s).integrable_mul (test_deriv_memLp hφ hcφ (direction i a))),
    integral_finsetSum Finset.univ (fun k _ => show Integrable (fun x =>
      (ψ k).gradient s i a x * (φ x : ℂ)) from
      ((hψ k).2.1 s i a).integrable_mul (test_memLp hφ hcφ))]
  simp only [(hψ _).2.2 s i a φ hφ hcφ, Finset.sum_neg_distrib]

lemma SobolevVector.scale {N : ℕ} {ψ : FormVector N} (hψ : SobolevVector ψ) (c : ℝ) :
    SobolevVector (scaleForm c ψ) := by
  refine ⟨fun s => (hψ.1 s).const_mul _, fun s i a => (hψ.2.1 s i a).const_mul _, ?_⟩
  intro s i a φ hφ hcφ
  change (∫ x, ((c : ℂ) * ψ.value s x) * Complex.ofReal (lineDeriv ℝ φ x (direction i a))) =
    -(∫ x, ((c : ℂ) * ψ.gradient s i a x) * (φ x : ℂ))
  simp only [mul_assoc, integral_const_mul, hψ.2.2 s i a φ hφ hcφ, mul_neg]

lemma norm_sum_sq_disjoint {ι : Type*} [Fintype ι] (v : ι → ℂ)
    (h : ∀ i j, i ≠ j → v i = 0 ∨ v j = 0) :
    ‖∑ i, v i‖^2 = ∑ i, ‖v i‖^2 := by
  classical
  by_cases hz : ∀ i, v i = 0
  · simp [hz]
  · push Not at hz
    obtain ⟨i,hi⟩ := hz
    have hh (j : ι) (hji : j ≠ i) : v j = 0 := (h j i hji).resolve_right hi
    rw [Finset.sum_eq_single i (fun j _ hj => hh j hj) (by simp),
      Finset.sum_eq_single i (fun j _ hj => by simp [hh j hj]) (by simp)]

def FormsDisjoint {ι : Type*} {N : ℕ} (ψ : ι → FormVector N) : Prop :=
  (∀ k l, k ≠ l → ∀ s x, (ψ k).value s x = 0 ∨ (ψ l).value s x = 0) ∧
  (∀ k l, k ≠ l → ∀ s i a x,
    (ψ k).gradient s i a x = 0 ∨ (ψ l).gradient s i a x = 0)

lemma formMass_sum_disjoint {ι : Type*} [Fintype ι] {N : ℕ} {ψ : ι → FormVector N}
    (hψ : ∀ k, SobolevVector (ψ k)) (hd : FormsDisjoint ψ) :
    formMass (sumForm ψ) = ∑ k, formMass (ψ k) := by
  unfold formMass
  have hh (s : Spins N) : (∫ x, ‖(sumForm ψ).value s x‖^2) =
      ∑ k, ∫ x, ‖(ψ k).value s x‖^2 := by
    simp only [sumForm, norm_sum_sq_disjoint _ (fun k l hkl => hd.1 k l hkl s _)]
    exact integral_finsetSum _ (fun k _ => ((hψ k).1 s).norm.integrable_sq)
  simp_rw [hh]
  exact Finset.sum_comm

lemma formEnergy_sum_disjoint {ι : Type*} [Fintype ι] {N : ℕ} {ψ : ι → FormVector N}
    (hψ : ∀ k, SobolevVector (ψ k)) (hd : FormsDisjoint ψ) (Z : ℝ) :
    formEnergy Z (sumForm ψ) = ∑ k, formEnergy Z (ψ k) := by
  classical
  have hk (s : Spins N) (i : Fin N) (a : Fin 3) :
      (∫ x, ‖(sumForm ψ).gradient s i a x‖^2) = ∑ k, ∫ x, ‖(ψ k).gradient s i a x‖^2 := by
    simp only [sumForm, norm_sum_sq_disjoint _ (fun k l hkl => hd.2 k l hkl s i a _)]
    exact integral_finsetSum _ (fun k _ => ((hψ k).2.1 s i a).norm.integrable_sq)
  have hn (s : Spins N) (i : Fin N) :
      (∫ x, ‖(sumForm ψ).value s x‖^2 / ‖x i‖) =
      ∑ k, ∫ x, ‖(ψ k).value s x‖^2 / ‖x i‖ := by
    simp only [sumForm, norm_sum_sq_disjoint _ (fun k l hkl => hd.1 k l hkl s _), Finset.sum_div]
    exact integral_finsetSum _ (fun k _ => (hψ k).nuclear_integrable s i)
  have hp (s : Spins N) (i j : Fin N) :
      (if i < j then ∫ x, ‖(sumForm ψ).value s x‖^2 / ‖x i-x j‖ else 0) =
      ∑ k, if i < j then ∫ x, ‖(ψ k).value s x‖^2 / ‖x i-x j‖ else 0 := by
    by_cases hij : i < j
    · simp only [ite_eq_left hij, sumForm,
        norm_sum_sq_disjoint _ (fun k l hkl => hd.1 k l hkl s _), Finset.sum_div]
      exact integral_finsetSum _ (fun k _ => (hψ k).pair_integrable s i j hij.ne)
    · simp only [ite_eq_right hij, Finset.sum_const_zero]
  unfold formEnergy
  simp_rw [hk,hn,hp]
  rw [show (∑ s, ∑ i, ∑ a, ∑ k, ∫ x, ‖(ψ k).gradient s i a x‖^2) =
    ∑ k, ∑ s, ∑ i, ∑ a, ∫ x, ‖(ψ k).gradient s i a x‖^2 by
      simp_rw [Finset.sum_comm (s := Finset.univ) (t := Finset.univ) (f := fun a k =>
        ∫ x, ‖(ψ k).gradient _ _ a x‖^2)]
      simp_rw [Finset.sum_comm (s := Finset.univ) (t := Finset.univ) (f := fun i k =>
        ∑ a, ∫ x, ‖(ψ k).gradient _ i a x‖^2)]
      exact Finset.sum_comm,
    show (∑ s, ∑ i, ∑ k, ∫ x, ‖(ψ k).value s x‖^2 / ‖x i‖) =
    ∑ k, ∑ s, ∑ i, ∫ x, ‖(ψ k).value s x‖^2 / ‖x i‖ by
      simp_rw [Finset.sum_comm (s := Finset.univ) (t := Finset.univ) (f := fun i k =>
        ∫ x, ‖(ψ k).value _ x‖^2 / ‖x i‖)]
      exact Finset.sum_comm,
    show (∑ s, ∑ i, ∑ j, ∑ k, if i < j then ∫ x, ‖(ψ k).value s x‖^2 / ‖x i-x j‖ else 0) =
    ∑ k, ∑ s, ∑ i, ∑ j, if i < j then ∫ x, ‖(ψ k).value s x‖^2 / ‖x i-x j‖ else 0 by
      simp_rw [Finset.sum_comm (s := Finset.univ) (t := Finset.univ) (f := fun j k =>
        if _ < j then ∫ x, ‖(ψ k).value _ x‖^2 / ‖x _-x j‖ else 0)]
      simp_rw [Finset.sum_comm (s := Finset.univ) (t := Finset.univ) (f := fun i k =>
        ∑ j, if i < j then ∫ x, ‖(ψ k).value _ x‖^2 / ‖x i-x j‖ else 0)]
      exact Finset.sum_comm]
  simp only [Finset.mul_sum, Finset.sum_sub_distrib, Finset.sum_add_distrib]

end CoulombAtom

open MeasureTheory Filter
open scoped BigOperators

end

end OAI