Cartesian vector calculus on (Clausius–Duhem mission)
DefinitionClausiusDuhem_field_calculusVector calculus on physical space in Cartesian coordinates .
- Partial derivative of a scalar field : , the Fréchet derivative of at applied to the unit vector .
- Gradient ; divergence ; dot product .
- Velocity gradient and double contraction .
- Partial time derivative and material time derivative
- Outward flux through the boundary of the box :
These are the operators in which every statement of the mission is written.
Formalization Note Space is Fin 3 → ℝ. Derivatives are Fréchet derivatives (Mathlib fderiv, deriv), which return at points of non-differentiability; all theorems of the mission assume enough differentiability that this convention is never used. Each box face is parametrized by the two remaining coordinates and carries two-dimensional Lebesgue measure.
import Mathlib
/-!
Vector calculus on Euclidean 3-space `ℝ³ = Fin 3 → ℝ`, in Cartesian coordinates,
as used in the Wikipedia article "Clausius–Duhem inequality" (oldid=1182390552).
-/
namespace ClausiusDuhem
/-- Physical space `ℝ³`, with Cartesian coordinates `x 0, x 1, x 2`. -/
abbrev Space := Fin 3 → ℝ
/-- The partial derivative `∂f/∂x_j` of a scalar field `f` at the point `x`. -/
noncomputable def partialDeriv (f : Space → ℝ) (j : Fin 3) (x : Space) : ℝ :=
fderiv ℝ f x (Pi.single j (1 : ℝ))
/-- The gradient `∇f(x) = (∂f/∂x_0, ∂f/∂x_1, ∂f/∂x_2)` of a scalar field. -/
noncomputable def grad (f : Space → ℝ) (x : Space) : Fin 3 → ℝ :=
fun j => partialDeriv f j x
/-- The divergence `∇ · F(x) = ∑_j ∂F_j/∂x_j` of a vector field `F`. -/
noncomputable def div (F : Space → Fin 3 → ℝ) (x : Space) : ℝ :=
∑ j : Fin 3, partialDeriv (fun y => F y j) j x
/-- The Euclidean dot product `u · w = ∑_i u_i w_i`. -/
def dot (u w : Fin 3 → ℝ) : ℝ :=
∑ i : Fin 3, u i * w i
/-- The velocity gradient `(∇v)_{ij} = ∂v_i/∂x_j` of a vector field `v`. -/
noncomputable def velocityGradient (v : Space → Fin 3 → ℝ) (x : Space) :
Matrix (Fin 3) (Fin 3) ℝ :=
fun i j => partialDeriv (fun y => v y i) j x
/-- The double contraction `A : B = ∑_{i,j} A_{ij} B_{ij}` of two second-order tensors. -/
def doubleDot (A B : Matrix (Fin 3) (Fin 3) ℝ) : ℝ :=
∑ i : Fin 3, ∑ j : Fin 3, A i j * B i j
/-- The partial time derivative `∂φ/∂t (t, x)` of a time-dependent scalar field. -/
noncomputable def timeDeriv (φ : ℝ → Space → ℝ) (t : ℝ) (x : Space) : ℝ :=
deriv (fun τ => φ τ x) t
/-- The material time derivative `φ̇ = ∂φ/∂t + ∇φ · v` of a scalar field `φ`
following the velocity field `v`. -/
noncomputable def materialDeriv (φ : ℝ → Space → ℝ) (v : ℝ → Space → Fin 3 → ℝ)
(t : ℝ) (x : Space) : ℝ :=
timeDeriv φ t x + dot (grad (φ t) x) (v t x)
/-- The outward flux `∫_{∂Ω} F · n dA` of a vector field `F` through the boundary of the
closed rectangular box `Ω = [a, b] = ∏_i [a_i, b_i]`. The face `x_i = b_i` has outward
normal `e_i` and the face `x_i = a_i` has outward normal `-e_i`; each face is parametrised by
the two remaining coordinates and carries two-dimensional Lebesgue (area) measure. -/
noncomputable def boxOutwardFlux (F : Space → Fin 3 → ℝ) (a b : Space) : ℝ :=
∑ i : Fin 3,
((∫ y in Set.Icc (a ∘ i.succAbove) (b ∘ i.succAbove), F (i.insertNth (b i) y) i) -
∫ y in Set.Icc (a ∘ i.succAbove) (b ∘ i.succAbove), F (i.insertNth (a i) y) i)
end ClausiusDuhem
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter
Non-blind read-back — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statements, with full knowledge of the source article and of the intended meaning. It was not produced by a blind, independent auditor, so it must not be mistaken for independent testimony; reviewers should compare it against the Lean code themselves.
This file introduces, inside the namespace ClausiusDuhem, the following objects, where space means the set of functions (i.e. with its product structure).
- Partial derivative. For , and : , the Fréchet derivative of at evaluated on the -th standard basis vector. If is not differentiable at , the Fréchet derivative is by convention the zero map, so .
- Gradient. .
- Divergence. For : , where is the -th component function.
- Dot product. .
- Velocity gradient. For : the real matrix .
- Double contraction. For real matrices: .
- Time derivative. For (curried as ): , the one-variable derivative; it is if is not differentiable at .
- Material derivative. For as above and :
- Box outward flux. For and :
where is the closed rectangle (coordinates other than , in increasing order), is the point whose -th coordinate is and whose other two coordinates are , and is two-dimensional Lebesgue measure. The integrals are Bochner integrals, equal to when the integrand is not integrable. No condition is imposed by the definition itself (if for some , is empty).