Imports
/- Copyright (c) 2026 Giuseppe Sorge. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Giuseppe Sorge -/ module public import Physlib.SpaceAndTime.Time.Derivatives public import Mathlib.Analysis.Matrix.Normed

Time derivatives of matrix-valued functions

General lemmas on the time derivative ∂ₜ of square-matrix-valued functions of time: a product rule, the commutation of the derivative with transpose, and the commutation of the derivative with taking a matrix entry. These are the tools needed to differentiate a path of matrices.

They rely on the (opt-in) operator-norm structure on matrices — activated here as local instances — only to invoke the product rule and to view transpose (through Matrix.transposeLinearEquiv) as a continuous linear map. Since all norms on a fixed finite-dimensional space induce the same topology, differentiability does not depend on this choice.

@[expose] public sectionattribute [local instance] Matrix.linftyOpNormedAddCommGroup Matrix.linftyOpNormedSpace Matrix.linftyOpNormedRing Matrix.linftyOpNormedAlgebra

The transpose of a differentiable matrix-valued function is differentiable (cf. Continuous.matrix_transpose).

lemma DifferentiableAt.matrix_transpose {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {A : E → Matrix (Fin d) (Fin d) ℝ} {t : E} (hA : DifferentiableAt ℝ A t) : DifferentiableAt ℝ (fun s => (A s)ᵀ) t := ((transposeLinearEquiv (Fin d) (Fin d) ℝ ℝ).toLinearMap.toContinuousLinearMap).differentiableAt |>.comp t hA

Product rule for the time derivative of a product of matrix-valued functions.

d:ℕA:Time → Matrix (Fin d) (Fin d) ℝB:Time → Matrix (Fin d) (Fin d) ℝt:TimehA:DifferentiableAt ℝ A thB:DifferentiableAt ℝ B th:HasFDerivAt (fun s => A s * B s) (A t •> fderiv ℝ B t + fderiv ℝ A t <• B t) t⊢ (A t •> fderiv ℝ B t) 1 + (fderiv ℝ A t <• B t) 1 = A t * (fderiv ℝ B t) 1 + (fderiv ℝ A t) 1 * B t All goals completed! 🐙

The time derivative commutes with transpose.

d:ℕA:Time → Matrix (Fin d) (Fin d) ℝt:TimehA:DifferentiableAt ℝ A tT:Matrix (Fin d) (Fin d) ℝ →L[ℝ] Matrix (Fin d) (Fin d) ℝ := LinearMap.toContinuousLinearMap ↑(transposeLinearEquiv (Fin d) (Fin d) ℝ ℝ)h:HasFDerivAt (fun s => (A s)ᵀ) (T ∘SL fderiv ℝ A t) t⊢ (T ∘SL fderiv ℝ A t) 1 = ((fderiv ℝ A t) 1)ᵀ All goals completed! 🐙

The time derivative commutes with taking a matrix entry.

d:ℕA:Time → Matrix (Fin d) (Fin d) ℝt:TimehA:DifferentiableAt ℝ A ti:Fin dj:Fin dE:Matrix (Fin d) (Fin d) ℝ →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (entryLinearMap ℝ ℝ i j)h:HasFDerivAt (fun s => A s i j) (E ∘SL fderiv ℝ A t) t⊢ (E ∘SL fderiv ℝ A t) 1 = (fderiv ℝ A t) 1 i j All goals completed! 🐙