Imports
/- Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhi Kai Pong, Joseph Tooby-Smith, Lode Vermeulen -/ module public import Physlib.SpaceAndTime.Space.Derivatives.Grad public import Physlib.SpaceAndTime.Space.DistOfFunction

Divergence on Space

i. Overview

In this module we define the divergence operator on functions and distributions from Space d to EuclideanSpace ℝ (Fin d), and prove various basic properties about it.

ii. Key results

    div : The divergence operator on functions from Space d to EuclideanSpace ℝ (Fin d).

    distDiv : The divergence operator on distributions from Space d to EuclideanSpace ℝ (Fin d).

    distDiv_ofFunction : The divergence of a distribution from a bounded function.

iii. Table of contents

    A. The divergence on functions

      A.1. The divergence on the zero function

      A.2. The divergence on a constant function

      A.3. The divergence distributes over addition

      A.4. The divergence distributes over scalar multiplication

      A.5. The divergence of a linear map is a linear map

    B. Divergence of distributions

      B.1. Basic equalities

      B.2. Divergence on distributions from bounded functions

iv. References

@[expose] public section

A. The divergence on functions

@[inherit_doc div] macro (name := divNotation) "∇" "⬝" f:term:100 : term => `(div $f)d:ℕf:Space d → EuclideanSpace ℝ (Fin d)hf:Differentiable ℝ fx:Space di:Fin d⊢ (deriv i (fun x => f x) x).ofLp i = ((fderiv ℝ f x) (basis i)).ofLp id:ℕf:Space d → EuclideanSpace ℝ (Fin d)hf:Differentiable ℝ fx:Space di:Fin d⊢ Differentiable ℝ f d:ℕf:Space d → EuclideanSpace ℝ (Fin d)hf:Differentiable ℝ fx:Space di:Fin d⊢ Differentiable ℝ f All goals completed! 🐙

A.1. The divergence on the zero function

@[simp] lemma div_zero : ∇ ⬝ (0 : Space d → EuclideanSpace ℝ (Fin d)) = 0 := d:ℕ⊢ div 0 = 0 d:ℕ⊢ (fun x => (Multiset.map (fun i => (fderiv ℝ (fun x => (0 x).ofLp i) x) (basis i)) Finset.univ.val).sum) = 0 d:ℕ⊢ (fun x => 0) = 0 All goals completed! 🐙

A.2. The divergence on a constant function

@[simp] lemma div_const : ∇ ⬝ (fun _ : Space d => v) = 0 := d:ℕv:EuclideanSpace ℝ (Fin d)⊢ (div fun x => v) = 0 d:ℕv:EuclideanSpace ℝ (Fin d)⊢ (fun x => (Multiset.map (fun i => (fderiv ℝ (fun x => ((fun x => v) x).ofLp i) x) (basis i)) Finset.univ.val).sum) = 0 d:ℕv:EuclideanSpace ℝ (Fin d)⊢ (fun x => 0) = 0 All goals completed! 🐙

A.3. The divergence distributes over addition

d:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ (fderiv ℝ (fun x => (f1 x).ofLp i) x + fderiv ℝ (fun x => (f2 x).ofLp i) x) (basis i) = (fderiv ℝ (fun x => (f1 x).ofLp i) x) (basis i) + (fderiv ℝ (fun x => (f2 x).ofLp i) x) (basis i)d:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f1 x).ofLp i) xd:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f2 x).ofLp i) x d:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f1 x).ofLp i) xd:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f2 x).ofLp i) x d:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f1 x).ofLp i) x All goals completed! 🐙 d:ℕf1:Space d → EuclideanSpace ℝ (Fin d)f2:Space d → EuclideanSpace ℝ (Fin d)hf1:Differentiable ℝ f1hf2:Differentiable ℝ f2x:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f2 x).ofLp i) x All goals completed! 🐙

A.4. The divergence distributes over scalar multiplication

d:ℕf:Space d → EuclideanSpace ℝ (Fin d)k:ℝhf:Differentiable ℝ fx:Space di:Fin d⊢ (k • fderiv ℝ (fun x => (f x).ofLp i) x) (basis i) = k * (fderiv ℝ (fun x => (f x).ofLp i) x) (basis i)d:ℕf:Space d → EuclideanSpace ℝ (Fin d)k:ℝhf:Differentiable ℝ fx:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f x).ofLp i) x d:ℕf:Space d → EuclideanSpace ℝ (Fin d)k:ℝhf:Differentiable ℝ fx:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f x).ofLp i) x d:ℕf:Space d → EuclideanSpace ℝ (Fin d)k:ℝhf:Differentiable ℝ fx:Space di:Fin d⊢ DifferentiableAt ℝ (fun x => (f x).ofLp i) x All goals completed! 🐙

A.5. The divergence of a linear map is a linear map

W:Type u_1inst✝¹:NormedAddCommGroup Winst✝:NormedSpace ℝ Wf:W → Space → EuclideanSpace ℝ (Fin 3)hf:∀ (w : W), Differentiable ℝ (f w)hf':IsLinearMap ℝ fk:ℝw:W⊢ Differentiable ℝ (f w) All goals completed! 🐙

B. Divergence of distributions

@[inherit_doc distDiv] macro (name := distDivNotation) "∇ᵈ" "⬝" f:term:100 : term => `(distDiv $f)

B.1. Basic equalities

lemma distDiv_apply_eq_sum_fderivD {d} (f : (Space d) →d[ℝ] EuclideanSpace ℝ (Fin d)) (η : 𝓢(Space d, ℝ)) : (∇ᵈ ⬝ f) η = ∑ i, fderivD ℝ f η (basis i) i := d:ℕf:(Space d)→d[ℝ] EuclideanSpace ℝ (Fin d)η:𝓢(Space d, ℝ)⊢ (distDiv f) η = ∑ i, ((((fderivD ℝ) f) η) (basis i)).ofLp i All goals completed! 🐙d:ℕf:(Space d)→d[ℝ] EuclideanSpace ℝ (Fin d)η:𝓢(Space d, ℝ)⊢ ∑ i, ((((fderivD ℝ) f) η) (basis i)).ofLp i = ∑ i, (((distDeriv i) f) η).ofLp i All goals completed! 🐙

B.2. Divergence on distributions from bounded functions

The divergence of a distribution from a bounded function.

All goals completed! 🐙