Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Physlib/SpaceAndTime/WaveVectorSpace/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ noncomputable instance instNormedAddCommGroup : NormedAddCommGroup (WaveVectorSp
noncomputable instance instInnerProductSpaceReal : InnerProductSpace ℝ (WaveVectorSpace d) :=
InnerProductSpace.ofCore instCoreReal.toCore

/-- The normed space structure on `WaveVectorSpace d`, registered directly. It is definitionally the
one underlying the inner product space structure, but registering it as its own instance is
needed for typeclass search to find the operator-norm structure on `WaveVectorSpace d →L[ℝ] ℝ`
(for example `NormSMulClass ℝ (WaveVectorSpace d →L[ℝ] ℝ)`), which is not found when
`NormedSpace ℝ (WaveVectorSpace d)` arises only as a nested subgoal through
`InnerProductSpace.toNormedSpace`. -/
noncomputable instance : NormedSpace ℝ (WaveVectorSpace d) := InnerProductSpace.toNormedSpace

lemma norm_eq (k : WaveVectorSpace d) : ‖k‖ = √(∑ i, k i ^ 2) := by
simp_rw [norm_eq_sqrt_real_inner, inner_apply, pow_two]

Expand Down
34 changes: 34 additions & 0 deletions Physlib/SpaceAndTime/WaveVectorSpace/DualPairing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ def dual (x : Space d) : StrongDual ℝ (WaveVectorSpace d) where

lemma dual_apply (x : Space d) (k : WaveVectorSpace d) : x.dual k = k ⬝ᵥ x := rfl

@[simp]
lemma opNorm_dual_eq_norm (x : Space d) : ‖x.dual‖ = ‖x‖ := by
refine ContinuousLinearMap.opNorm_eq_of_bounds (norm_nonneg x) (fun k ↦ ?_) fun N hN h ↦ ?_
· calc
_ = |inner ℝ (WithLp.toLp 2 x.val) (WithLp.toLp 2 k.val)| := by
simp [dual_apply, inner, dotProduct]
_ ≤ ‖WithLp.toLp 2 x.val‖ * ‖WithLp.toLp 2 k.val‖ := abs_real_inner_le_norm _ _
_ = ‖x‖ * ‖k‖ := by simp [PiLp.norm_eq_of_L2, norm_eq, WaveVectorSpace.norm_eq]
· suffices ‖x‖ ^ 2 ≤ N * ‖x‖ by nlinarith
simpa [dual_apply, dotProduct, ← pow_two, ← norm_sq_eq, WaveVectorSpace.norm_eq] using h ⟨x⟩

end Space

namespace WaveVectorSpace
Expand All @@ -70,6 +81,17 @@ def dual (k : WaveVectorSpace d) : StrongDual ℝ (Space d) where

lemma dual_apply (k : WaveVectorSpace d) (x : Space d) : k.dual x = k ⬝ᵥ x := rfl

@[simp]
lemma opNorm_dual_eq_norm (k : WaveVectorSpace d) : ‖k.dual‖ = ‖k‖ := by
refine ContinuousLinearMap.opNorm_eq_of_bounds (norm_nonneg k) (fun x ↦ ?_) fun N hN h ↦ ?_
· calc
_ = |inner ℝ (WithLp.toLp 2 x.val) (WithLp.toLp 2 k.val)| := by
simp [dual_apply, inner, dotProduct]
_ ≤ ‖WithLp.toLp 2 x.val‖ * ‖WithLp.toLp 2 k.val‖ := abs_real_inner_le_norm _ _
_ = ‖k‖ * ‖x‖ := by simp [PiLp.norm_eq_of_L2, norm_eq, Space.norm_eq, mul_comm]
· suffices ‖k‖ ^ 2 ≤ N * ‖k‖ by nlinarith
simpa [dual_apply, dotProduct, ← pow_two, ← norm_sq_eq, Space.norm_eq] using h ⟨k⟩

/-!
## B. Bilinear pairing
-/
Expand All @@ -88,6 +110,18 @@ lemma pairingCLM_apply_eq_dual (k : WaveVectorSpace d) : pairingCLM k = k.dual :

lemma pairingCLM_flip_apply_eq_dual (x : Space d) : pairingCLM.flip x = x.dual := rfl

@[simp]
lemma pairingCLM_apply_apply (k : WaveVectorSpace d) (x : Space d) : pairingCLM k x = k ⬝ᵥ x := rfl

@[fun_prop]
lemma continuous_dual : Continuous (dual : WaveVectorSpace d → StrongDual ℝ (Space d)) :=
pairingCLM.continuous

@[fun_prop]
lemma _root_.Space.continuous_dual :
Continuous (Space.dual : Space d → StrongDual ℝ (WaveVectorSpace d)) :=
pairingCLM.flip.continuous

/-!
## C. Derivatives
-/
Expand Down
225 changes: 192 additions & 33 deletions Physlib/SpaceAndTime/WaveVectorSpace/Fourier.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: Gregory J. Loges
-/
module

public import Mathlib.Analysis.Fourier.FourierTransform
public import Physlib.SpaceAndTime.WaveVectorSpace.DualPairing
/-!

Expand Down Expand Up @@ -48,12 +47,23 @@ for $(a,b) = (1,-1)$). If a common convention is missing it can be added below i
- `fourierIntegralInv a b` : the inverse Fourier integral with real parameters `a` and `b`,
corresponding to a choice of convention, which maps a function `g : WaveVectorSpace d → E`
to its Fourier transform of type `Space d → E`.
- `deriv_fourierIntegral` / `deriv_fourierIntegralInv` : for a suitably nice function
`f : Space d → E` the derivative along the `i`ᵗʰ coordinate direction of its Fourier integral
is the Fourier integral of the function `x ↦ (b * I * x i) • f x`, and similarly for functions
`WaveVectorSpace d → E` and the inverse Fourier integral.

## iii. Table of contents

- A. Fourier integrals
- A.1. Two-parameter definitions
- A.2. Basic properties
- A.2.1. Linearity
- A.2.2. Continuity
- A.2.3. Integration of continuous linear maps
- A.3. Derivatives
- A.3.1. Fourier multipliers
- A.3.2. Fréchet derivatives
- A.3.3. Partial derivatives
- B. Fourier instances
- B.1. `(a, b) = (0, 1)` (default)
- B.2. `(a, b) = (1, -1)`
Expand All @@ -79,27 +89,15 @@ namespace WaveVectorSpace

section FourierIntegral

open MeasureTheory
open scoped Real
open Complex MeasureTheory Real
open scoped FourierTransform

variable (a b : ℝ) {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E]

/-!
### A.1. Two-parameter definitions
-/

/-- The additive character `fun r ↦ exp (b * r * I)` from `ℝ` to the unit circle in `ℂ`. -/
noncomputable def physChar : AddChar ℝ Circle where
toFun r := Circle.exp (b * r)
map_zero_eq_one' := by rw [mul_zero, Circle.exp_zero]
map_add_eq_mul' _ _ := by rw [mul_add, Circle.exp_add]

variable {b} in
@[fun_prop]
lemma physChar_continuous : Continuous (physChar b) := by
rw [AddChar.coe_mk]
fun_prop

/-- The Fourier integral over `Space`,

`√(|b| / (2 * π) ^ (1 - a)) • ∫ x, exp (b * (k ⬝ᵥ x) * I) • f x ∂volume`,
Expand All @@ -108,20 +106,20 @@ parametrized by `a b : ℝ`.
-/
noncomputable def fourierIntegral (f : Space d → E) (k : WaveVectorSpace d) : E :=
√(|b| / (2 * π) ^ (1 - a))
• VectorFourier.fourierIntegral (physChar b) volume (-pairingCLM.flip.toLinearMap₁₂) f k
• VectorFourier.fourierIntegral 𝐞 volume (-(b / (2 * π)) • pairingCLM.flip).toLinearMap₁₂ f k

lemma fourierIntegral_def (f : Space d → E) :
fourierIntegral a b f
= √(|b| / (2 * π) ^ (1 - a))
• VectorFourier.fourierIntegral (physChar b) volume (-pairingCLM.flip.toLinearMap₁₂) f :=
• VectorFourier.fourierIntegral 𝐞 volume
(-(b / (2 * π)) • pairingCLM.flip).toLinearMap₁₂ f :=
rfl

open Complex in
lemma fourierIntegral_eq (f : Space d → E) (k : WaveVectorSpace d) :
fourierIntegral a b f k
= √(|b| / (2 * π) ^ (1 - a)) • ∫ x : Space d, cexp (b * (k ⬝ᵥ x) * I) • f x := by
simp [fourierIntegral_def, VectorFourier.fourierIntegral, physChar, pairingCLM_apply_eq_dual,
dual_apply, Circle.smul_def]
simp [fourierIntegral_def, VectorFourier.fourierIntegral, fourierChar, pairingCLM_apply_eq_dual,
dual_apply, Circle.smul_def, ← mul_assoc, mul_div_cancel₀]

/-- The inverse Fourier integral over `WaveVectorSpace`,

Expand All @@ -131,20 +129,19 @@ parametrized by `a b : ℝ`.
-/
noncomputable def fourierIntegralInv (g : WaveVectorSpace d → E) (x : Space d) : E :=
√(|b| / (2 * π) ^ (1 + a))
• VectorFourier.fourierIntegral (physChar b) volume pairingCLM.toLinearMap₁₂ g x
• VectorFourier.fourierIntegral 𝐞 volume ((b / (2 * π)) • pairingCLM).toLinearMap₁₂ g x

lemma fourierIntegralInv_def (g : WaveVectorSpace d → E) :
fourierIntegralInv a b g
= √(|b| / (2 * π) ^ (1 + a))
• VectorFourier.fourierIntegral (physChar b) volume pairingCLM.toLinearMap₁₂ g :=
• VectorFourier.fourierIntegral 𝐞 volume ((b / (2 * π)) • pairingCLM).toLinearMap₁₂ g :=
rfl

open Complex in
lemma fourierIntegralInv_eq (g : WaveVectorSpace d → E) (x : Space d) :
fourierIntegralInv a b g x
= √(|b| / (2 * π) ^ (1 + a)) • ∫ k : WaveVectorSpace d, cexp (-b * (k ⬝ᵥ x) * I) • g k := by
simp [fourierIntegralInv_def, VectorFourier.fourierIntegral, physChar, pairingCLM_apply_eq_dual,
dual_apply, Circle.smul_def, Complex.exp_neg]
simp [fourierIntegralInv_def, VectorFourier.fourierIntegral, pairingCLM_apply_eq_dual,
fourierChar, dual_apply, Circle.smul_def, Complex.exp_neg, ← mul_assoc, mul_div_cancel₀]

/-!
### A.2. Basic properties
Expand All @@ -159,6 +156,10 @@ lemma fourierIntegralInv_congr_ae {g₁ g₂ : WaveVectorSpace d → E} (hg : g
rw [fourierIntegralInv_def, fourierIntegralInv_def,
VectorFourier.fourierIntegral_congr_ae _ _ _ hg]

/-!
#### A.2.1. Linearity
-/

lemma fourierIntegral_const_smul (f : Space d → E) (c : ℂ) :
fourierIntegral a b (c • f) = c • fourierIntegral a b f := by
simp only [fourierIntegral_def, VectorFourier.fourierIntegral_const_smul, smul_comm c]
Expand All @@ -169,24 +170,182 @@ lemma fourierIntegralInv_const_smul (f : WaveVectorSpace d → E) (c : ℂ) :

lemma fourierIntegral_add {f₁ f₂ : Space d → E} (hf₁ : Integrable f₁) (hf₂ : Integrable f₂) :
fourierIntegral a b (f₁ + f₂) = fourierIntegral a b f₁ + fourierIntegral a b f₂ := by
rw [fourierIntegral_def, fourierIntegral_def, fourierIntegral_def, ← smul_add,
VectorFourier.fourierIntegral_add physChar_continuous pairingCLM.flip.continuous₂.neg hf₁ hf₂]
simp only [fourierIntegral_def, ← smul_add]
rw [VectorFourier.fourierIntegral_add continuous_fourierChar
(-(b / (2 * π)) • pairingCLM.flip).continuous₂ hf₁ hf₂]

lemma fourierIntegralInv_add
{g₁ g₂ : WaveVectorSpace d → E} (hg₁ : Integrable g₁) (hg₂ : Integrable g₂) :
fourierIntegralInv a b (g₁ + g₂) = fourierIntegralInv a b g₁ + fourierIntegralInv a b g₂ := by
rw [fourierIntegralInv_def, fourierIntegralInv_def, fourierIntegralInv_def, ← smul_add,
VectorFourier.fourierIntegral_add physChar_continuous pairingCLM.continuous₂ hg₁ hg₂]
simp only [fourierIntegralInv_def, ← smul_add]
rw [VectorFourier.fourierIntegral_add continuous_fourierChar
((b / (2 * π)) • pairingCLM).continuous₂ hg₁ hg₂]

/-!
#### A.2.2. Continuity
-/

lemma fourierIntegral_continuous {f : Space d → E} (hf : Integrable f) :
Continuous (fourierIntegral a b f) :=
VectorFourier.fourierIntegral_continuous physChar_continuous pairingCLM.flip.continuous₂.neg hf
|>.const_smul _
VectorFourier.fourierIntegral_continuous continuous_fourierChar
(-(b / (2 * π)) • pairingCLM.flip).continuous₂ hf |>.const_smul _

lemma fourierIntegralInv_continuous {g : WaveVectorSpace d → E} (hg : Integrable g) :
Continuous (fourierIntegralInv a b g) :=
VectorFourier.fourierIntegral_continuous physChar_continuous pairingCLM.continuous₂ hg
|>.const_smul _
VectorFourier.fourierIntegral_continuous continuous_fourierChar
((b / (2 * π)) • pairingCLM).continuous₂ hg |>.const_smul _

/-!
#### A.2.3. Integration of continuous linear maps
-/

section IntegrandCLM

variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F]

/-- Given a CLM-valued function of space, `f : Space d → F →L[ℝ] E`,
evaluating its Fourier integral at `v : F` is the same as taking
the Fourier integral of `x ↦ f x v`. -/
lemma fourierIntegral_continuousLinearMap_apply
{f : Space d → F →L[ℝ] E} (hf : Integrable f) (k : WaveVectorSpace d) (v : F) :
fourierIntegral a b f k v = fourierIntegral a b (f · v) k := by
simp only [fourierIntegral_def, Pi.smul_apply, smul_apply,
VectorFourier.fourierIntegral_continuousLinearMap_apply continuous_fourierChar hf]

/-- Given a CLM-valued function of wavevector, `g : WaveVectorSpace d → F →L[ℝ] E`,
evaluating its inverse Fourier integral at `v : F` is the same as taking
the inverse Fourier integral of `k ↦ g k v`. -/
lemma fourierIntegralInv_continuousLinearMap_apply
{g : WaveVectorSpace d → F →L[ℝ] E} (hg : Integrable g) (x : Space d) (v : F) :
fourierIntegralInv a b g x v = fourierIntegralInv a b (g · v) x := by
simp only [fourierIntegralInv_def, Pi.smul_apply, smul_apply,
VectorFourier.fourierIntegral_continuousLinearMap_apply continuous_fourierChar hg]

end IntegrandCLM

/-!
### A.3. Derivatives
-/

/-!
#### A.3.1. Fourier multipliers
-/

/-- Send a function `f : Space d → E` to the function `f : Space d → Hom (WaveVectorSpace d, E)`
given by `x ↦ k ↦ b * I * (k ⬝ᵥ x) • f x`. This is designed so that the Fourier transform of
`fourierSMulRight b f` is the `fderiv` of the Fourier transform of `f`. -/
noncomputable def fourierSMulRight (f : Space d → E) (x : Space d) : WaveVectorSpace d →L[ℝ] E :=
(b * I) • x.dual.smulRight (f x)

/-- Send a function `g : WaveVectorSpace d → E` to the function
`g : WaveVectorSpace d → Hom (Space d, E)` given by `k ↦ x ↦ -b * I * (k ⬝ᵥ x) • g k`.
This is designed so that the inverse Fourier transform of `fourierInvSMulRight b g`
is the `fderiv` of the inverse Fourier transform of `g`. -/
noncomputable def fourierInvSMulRight (g : WaveVectorSpace d → E) (k : WaveVectorSpace d) :
Space d →L[ℝ] E :=
-(b * I) • k.dual.smulRight (g k)

lemma fourierSMulRight_eq (f : Space d → E) :
fourierSMulRight b f = fun x ↦ (b * I) • x.dual.smulRight (f x) :=
rfl

lemma fourierInvSMulRight_eq (g : WaveVectorSpace d → E) :
fourierInvSMulRight b g = fun k ↦ -(b * I) • k.dual.smulRight (g k) :=
rfl

@[simp]
lemma fourierSMulRight_apply (f : Space d → E) (x : Space d) (k : WaveVectorSpace d) :
fourierSMulRight b f x k = (b * I) • (k ⬝ᵥ x) • f x :=
rfl

@[simp]
lemma fourierInvSMulRight_apply (g : WaveVectorSpace d → E) (k : WaveVectorSpace d) (x : Space d) :
fourierInvSMulRight b g k x = -(b * I) • (k ⬝ᵥ x) • g k :=
rfl

@[simp]
lemma opNorm_fourierSMulRight (f : Space d → E) (x : Space d) :
‖fourierSMulRight b f x‖ = |b| * ‖x‖ * ‖f x‖ := by
simp [fourierSMulRight_eq, norm_smul, mul_assoc]

@[simp]
lemma opNorm_fourierInvSMulRight (g : WaveVectorSpace d → E) (k : WaveVectorSpace d) :
‖fourierInvSMulRight b g k‖ = |b| * ‖k‖ * ‖g k‖ := by
simp [fourierInvSMulRight_eq, norm_smul, mul_assoc]

@[fun_prop]
lemma aestronglyMeasurable_fourierSMulRight {f : Space d → E} (hf : AEStronglyMeasurable f) :
AEStronglyMeasurable (fourierSMulRight b f) := by
rw [fourierSMulRight_eq]
fun_prop

@[fun_prop]
lemma aestronglyMeasurable_fourierInvSMulRight
{g : WaveVectorSpace d → E} (hg : AEStronglyMeasurable g) :
AEStronglyMeasurable (fourierInvSMulRight b g) := by
rw [fourierInvSMulRight_eq]
fun_prop

lemma integrable_fourierSMulRight {f : Space d → E}
(hf : AEStronglyMeasurable f) (hf' : Integrable fun x ↦ ‖x‖ * ‖f x‖) :
Integrable (fourierSMulRight b f) :=
hf'.smul |b| |>.mono (by fun_prop) <| ae_of_all _ <| by simp [mul_assoc]

lemma integrable_fourierInvSMulRight {g : WaveVectorSpace d → E}
(hg : AEStronglyMeasurable g) (hg' : Integrable fun k ↦ ‖k‖ * ‖g k‖) :
Integrable (fourierInvSMulRight b g) :=
hg'.smul |b| |>.mono (by fun_prop) <| ae_of_all _ <| by simp [mul_assoc]

/-!
#### A.3.2. Fréchet derivatives
-/

lemma fderiv_fourierIntegral
{f : Space d → E} (hf : Integrable f) (hf' : Integrable fun x ↦ ‖x‖ * ‖f x‖) :
fderiv ℝ (fourierIntegral a b f) = fourierIntegral a b (fourierSMulRight b f) := by
rw [fourierIntegral_def, fderiv_const_smul_field, VectorFourier.fderiv_fourierIntegral _ hf hf']
congr with x k
calc
_ = (2 * π * I * (b / (2 * π) * pairingCLM k x)) • f x := by simp [← coe_smul, smul_smul]
_ = (b * I * pairingCLM k x) • f x := by field_simp
_ = (b * I) • (k ⬝ᵥ x) • f x := by simp [← coe_smul, smul_smul]

lemma fderiv_fourierIntegralInv
{g : WaveVectorSpace d → E} (hg : Integrable g) (hg' : Integrable (fun k ↦ ‖k‖ * ‖g k‖)) :
fderiv ℝ (fourierIntegralInv a b g) = fourierIntegralInv a b (fourierInvSMulRight b g) := by
rw [fourierIntegralInv_def, fderiv_const_smul_field,
VectorFourier.fderiv_fourierIntegral _ hg hg']
congr with k x
calc
_ = -(2 * π * I * (b / (2 * π) * pairingCLM k x)) • g k := by simp [← coe_smul, smul_smul]
_ = -(b * I * pairingCLM k x) • g k := by field_simp
_ = -(b * I) • (k ⬝ᵥ x) • g k := by simp [← coe_smul, smul_smul]

/-!
#### A.3.3. Partial derivatives
-/

/-- The partial derivative of the Fourier transform of `f` along coordinate `i`
is the Fourier transform of `x ↦ (b * I * x i) • f x`, provided both integrals exist. -/
lemma deriv_fourierIntegral (i : Fin d)
{f : Space d → E} (hf : Integrable f) (hf' : Integrable fun x ↦ ‖x‖ * ‖f x‖) :
∂[i] (fourierIntegral a b f) = fourierIntegral a b fun x ↦ (b * I * x i) • f x := by
ext
simp only [deriv_eq, hf, hf', fderiv_fourierIntegral, hf.aestronglyMeasurable,
integrable_fourierSMulRight, fourierIntegral_continuousLinearMap_apply]
congr
simp [dotProduct, ← nsmul_eq_mul, ← coe_smul, smul_smul]

/-- The partial derivative of the inverse Fourier transform of `g` along coordinate `i`
is the inverse Fourier transform of `k ↦ (-b * I * k i) • g k`, provided both integrals exist. -/
lemma deriv_fourierIntegralInv (i : Fin d)
{g : WaveVectorSpace d → E} (hg : Integrable g) (hg' : Integrable fun k ↦ ‖k‖ * ‖g k‖) :
∂[i] (fourierIntegralInv a b g) = fourierIntegralInv a b fun k ↦ -(b * I * k i) • g k := by
ext
simp only [Space.deriv_eq, hg, hg', fderiv_fourierIntegralInv, hg.aestronglyMeasurable,
integrable_fourierInvSMulRight, fourierIntegralInv_continuousLinearMap_apply]
congr
simp [dotProduct, Space.basis_apply, ← coe_smul, smul_smul]

end FourierIntegral

Expand Down
Loading