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! 🐙