File size: 9,282 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
import Mathlib
import OAI.Analysis.Conductivity.Sobolev.WallPrimitive

namespace OAI

noncomputable section

namespace ScalarConductivity

section
open Set MeasureTheory Filter Topology
variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [ProperSpace E]

def fiberPrimitive (a : ℝ) (f : E × ℝ → ℝ) (p : E × ℝ) : ℝ :=
  wallPrimitive f p-wallPrimitive f (p.1,a)

lemma fiberPrimitive_smooth (a : ℝ) {f : E × ℝ → ℝ}
    (hf : ContDiff ℝ (↑(⊤ : ℕ∞)) f) :
    ContDiff ℝ (↑(⊤ : ℕ∞)) (fiberPrimitive a f) :=
  (wallPrimitive_smooth hf).sub ((wallPrimitive_smooth hf).comp (contDiff_fst.prodMk contDiff_const))

omit [NormedSpace ℝ E] [ProperSpace E] in
lemma fiberPrimitive_eq_integral (a : ℝ) {f : E × ℝ → ℝ} (hf : Continuous f) (p : E × ℝ) :
    fiberPrimitive a f p=∫ t in a..p.2, f (p.1,t) := by
  have hc : Continuous (fun t : ℝ => f (p.1,t)) := hf.comp (continuous_const.prodMk continuous_id)
  change wallPrimitive f (p.1,p.2)-wallPrimitive f (p.1,a)=_
  simp only [wallPrimitive_eq_intervalIntegral]
  exact intervalIntegral.integral_interval_sub_left (μ := volume) (hc.intervalIntegrable _ _) (hc.intervalIntegrable _ _)

lemma fiberPrimitive_derivative (a : ℝ) {f : E × ℝ → ℝ}
    (hf : ContDiff ℝ (↑(⊤ : ℕ∞)) f) (p : E × ℝ) :
    wallDerivative (fiberPrimitive a f) p=f p := by
  have h := ((fiberPrimitive_smooth a hf).differentiable (by simp) p).hasFDerivAt.comp_hasDerivAt p.2
    ((hasDerivAt_const p.2 p.1).prodMk (hasDerivAt_id p.2))
  have hd : HasDerivAt (fun t : ℝ => fiberPrimitive a f (p.1,t)) (f p) p.2 := by
    exact (wallPrimitive_hasDerivAt hf.continuous p.1 p.2).sub_const (wallPrimitive f (p.1,a))
  exact h.unique hd

omit [NormedSpace ℝ E] [ProperSpace E]

lemma fiberPrimitive_of_zero_fiber (a : ℝ) {f : E × ℝ → ℝ} (hf : Continuous f)
    (x : E) (hx : ∀ t, f (x,t)=0) (z : ℝ) : fiberPrimitive a f (x,z)=0 := by
  rw [fiberPrimitive_eq_integral a hf]
  simp only [hx,intervalIntegral.integral_zero]

lemma fiberPrimitive_below {a b : ℝ} {f : E × ℝ → ℝ} (hf : Continuous f)
    (hv : ∀ p, f p≠0 → p.2∈Ioo a b) (p : E × ℝ) (hp : p.2≤a) :
    fiberPrimitive a f p=0 := by
  rw [fiberPrimitive_eq_integral a hf]
  calc
    _ = ∫ t in a..p.2, (0:ℝ) := by
      apply intervalIntegral.integral_congr
      intro t ht
      rw [uIcc_of_ge hp] at ht
      by_contra hn
      exact (not_lt_of_ge ht.2) (hv (p.1,t) hn).1
    _ = 0 := by simp

lemma fiberPrimitive_above {a b : ℝ} {f : E × ℝ → ℝ} (hf : Continuous f)
    (hv : ∀ p, f p≠0 → p.2∈Ioo a b)
    (hz : ∀ x, (∫ t in a..b, f (x,t))=0) (p : E × ℝ) (hp : b≤p.2) :
    fiberPrimitive a f p=0 := by
  have hc : Continuous (fun t : ℝ => f (p.1,t)) := hf.comp (continuous_const.prodMk continuous_id)
  rw [fiberPrimitive_eq_integral a hf,←intervalIntegral.integral_add_adjacent_intervals
    (hc.intervalIntegrable a b) (hc.intervalIntegrable b p.2),hz,zero_add]
  calc
    _ = ∫ t in b..p.2, (0:ℝ) := by
      apply intervalIntegral.integral_congr
      intro t ht
      rw [uIcc_of_le hp] at ht
      by_contra hn
      exact (not_lt_of_ge ht.1) (hv (p.1,t) hn).2
    _ = 0 := by simp

theorem fiberPrimitive_compact {a b : ℝ} {f : E × ℝ → ℝ} (hf : Continuous f)
    (hs : HasCompactSupport f) (hv : ∀ p, f p≠0 → p.2∈Ioo a b)
    (hz : ∀ x, (∫ t in a..b, f (x,t))=0) :
    HasCompactSupport (fiberPrimitive a f) ∧
      tsupport (fiberPrimitive a f) ⊆ (Prod.fst '' tsupport f) ×ˢ Icc a b := by
  have hK : IsCompact ((Prod.fst '' tsupport f) ×ˢ Icc a b) :=
    (hs.image continuous_fst).prod isCompact_Icc
  have hsub : Function.support (fiberPrimitive a f) ⊆ (Prod.fst '' tsupport f) ×ˢ Icc a b := by
    intro p hp
    refine ⟨?_,?_,?_⟩
    · by_contra hx
      have hz' : ∀ t, f (p.1,t)=0 := by
        intro t
        by_contra hn
        exact hx ⟨(p.1,t),subset_tsupport f hn,rfl⟩
      exact hp (fiberPrimitive_of_zero_fiber a hf p.1 hz' p.2)
    · by_contra h
      exact hp (fiberPrimitive_below hf hv p (le_of_lt (lt_of_not_ge h)))
    · by_contra h
      exact hp (fiberPrimitive_above hf hv hz p (le_of_lt (lt_of_not_ge h)))
  refine ⟨HasCompactSupport.of_support_subset_isCompact hK hsub,?_⟩
  exact closure_minimal hsub hK.isClosed

end

open Set MeasureTheory Matrix

variable {ι : Type*} [Fintype ι] [DecidableEq ι]

def compactMomentGram (χ : ℝ → ℝ) (w : ℝ → ι → ℝ) : Matrix ι ι ℝ :=
  fun i j => ∫ s, χ s*w s i*w s j

omit [Fintype ι] [DecidableEq ι] in
lemma compactMoment_integrable {χ : ℝ → ℝ} {w : ℝ → ι → ℝ}
    (hc : Continuous χ) (hs : HasCompactSupport χ) (hw : ∀ i, Continuous (fun s => w s i))
    (i j : ι) : Integrable (fun s => χ s*w s i*w s j) :=
  ((hc.mul (hw i)).mul (hw j)).integrable_of_hasCompactSupport ((hs.mul_right).mul_right)

omit [DecidableEq ι] in
lemma compactMoment_dot_integrable {χ : ℝ → ℝ} {w : ℝ → ι → ℝ}
    (hc : Continuous χ) (hs : HasCompactSupport χ) (hw : ∀ i, Continuous (fun s => w s i))
    (a : ι → ℝ) : Integrable (fun s => χ s*(a ⬝ᵥ w s)^2) := by
  apply Continuous.integrable_of_hasCompactSupport
  · exact hc.mul ((continuous_finsetSum _ (fun i _ => continuous_const.mul (hw i))).pow 2)
  · exact hs.mul_right

omit [DecidableEq ι] in
lemma compactMoment_quadratic {χ : ℝ → ℝ} {w : ℝ → ι → ℝ}
    (hc : Continuous χ) (hs : HasCompactSupport χ) (hw : ∀ i, Continuous (fun s => w s i))
    (a : ι → ℝ) : a ⬝ᵥ ((compactMomentGram χ w)*ᵥa)=∫ s, χ s*(a ⬝ᵥ w s)^2 := by
  have hi (i j : ι) : Integrable (fun s => a i*(χ s*w s i*w s j)*a j) :=
    ((compactMoment_integrable hc hs hw i j).const_mul _).mul_const _
  calc
    _ = ∑ i, ∑ j, ∫ s, a i*(χ s*w s i*w s j)*a j := by
      simp only [compactMomentGram,mulVec,dotProduct,Finset.mul_sum,
        integral_mul_const,integral_const_mul]
      apply Finset.sum_congr rfl
      intro i _
      apply Finset.sum_congr rfl
      intro j _
      ring
    _ = ∫ s, ∑ i, ∑ j, a i*(χ s*w s i*w s j)*a j := by
      rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => hi i j))]
      apply Finset.sum_congr rfl
      intro i _
      exact (integral_finsetSum _ (fun j _ => hi i j)).symm
    _ = _ := by
      apply integral_congr_ae
      exact Filter.Eventually.of_forall fun s => by
        simp only [dotProduct,pow_two,Finset.sum_mul,Finset.mul_sum]
        apply Finset.sum_congr rfl
        intro i _
        apply Finset.sum_congr rfl
        intro j _
        ring

omit [DecidableEq ι] in
theorem compactMomentGram_posDef {χ : ℝ → ℝ} {w : ℝ → ι → ℝ}
    (hc : Continuous χ) (hs : HasCompactSupport χ) (hw : ∀ i, Continuous (fun s => w s i))
    (hn : ∀ s, 0≤χ s) {l r : ℝ} (hp : ∀ s∈Ioo l r, 0<χ s)
    (hind : ∀ a : ι → ℝ, (∀ s∈Ioo l r, a ⬝ᵥ w s=0) → a=0) :
    (compactMomentGram χ w).PosDef := by
  apply Matrix.posDef_iff_dotProduct_mulVec.mpr
  refine ⟨?_,?_⟩
  · ext i j
    simp only [conjTranspose_apply,star_trivial,compactMomentGram]
    apply integral_congr_ae
    exact Filter.Eventually.of_forall (fun s => by ring)
  · intro a ha
    simp only [star_trivial]
    rw [compactMoment_quadratic hc hs hw]
    have hnon : ∀ s, 0≤χ s*(a ⬝ᵥ w s)^2 := fun s => mul_nonneg (hn s) (sq_nonneg _)
    apply (integral_nonneg hnon).lt_of_ne'
    intro hz
    have hae := (integral_eq_zero_iff_of_nonneg hnon
      (compactMoment_dot_integrable hc hs hw a)).mp hz
    have he := MeasureTheory.Measure.eq_of_ae_eq hae
      (hc.mul ((continuous_finsetSum _ (fun i _ => continuous_const.mul (hw i))).pow 2))
      continuous_zero
    apply ha
    apply hind
    intro s hs
    have h := congrFun he s
    have hsq : (a ⬝ᵥ w s)^2=0 := (mul_eq_zero.mp h).resolve_left (hp s hs).ne'
    nlinarith [sq_nonneg (a ⬝ᵥ w s)]

theorem compactMoment_surjective {χ : ℝ → ℝ} {w : ℝ → ι → ℝ}
    (hc : ContDiff ℝ (↑(⊤ : ℕ∞)) χ) (hs : HasCompactSupport χ)
    (hw : ∀ i, ContDiff ℝ (↑(⊤ : ℕ∞)) (fun s => w s i))
    (hG : (compactMomentGram χ w).PosDef) (b : ι → ℝ) :
    ∃ f : ℝ → ℝ, ContDiff ℝ (↑(⊤ : ℕ∞)) f ∧ HasCompactSupport f ∧
      tsupport f ⊆ tsupport χ ∧ (∀ i, (∫ s, f s*w s i)=b i) := by
  obtain ⟨a,ha⟩ := Matrix.mulVec_surjective_iff_isUnit.mpr hG.isUnit b
  refine ⟨fun s => χ s*(a ⬝ᵥ w s),hc.mul ?_,hs.mul_right,tsupport_mul_subset_left,?_⟩
  · exact ContDiff.sum (fun i _ => contDiff_const.mul (hw i))
  · intro i
    rw [←congrFun ha i]
    change (∫ s, χ s*(a ⬝ᵥ w s)*w s i)=∑ j, compactMomentGram χ w i j*a j
    calc
      _ = ∫ s, ∑ j, (χ s*w s i*w s j)*a j := by
        apply integral_congr_ae
        exact Filter.Eventually.of_forall (fun s => by
          simp only [dotProduct,Finset.mul_sum,Finset.sum_mul]
          apply Finset.sum_congr rfl; intro j _; ring)
      _ = _ := by
        rw [integral_finsetSum _ (fun j _ =>
          (compactMoment_integrable hc.continuous hs (fun j => (hw j).continuous) i j).mul_const _)]
        simp only [integral_mul_const,compactMomentGram]

end ScalarConductivity

end

end OAI