PhysLean Documentation

PhysLean.Mathematics.VariationalCalculus.HasVarAdjDeriv

Variational adjoint derivative #

Variational adjoint derivative of F at u is a generalization of (fderiv ℝ F u).adjoint to function spaces. In particular, variational gradient is an analog of gradient F u := (fderiv ℝ F u).adjoint 1.

The definition of HasVarAdjDerivAt is constructed exactly such that we can prove composition theorem saying

  HasVarAdjDerivAt F F' (G u)) → HasVarAdjDerivAt G G' u →
    HasVarAdjDerivAt (F ∘ G) (G' ∘ F') u

This theorem is the main tool to mechanistically compute variational gradient.

structure HasVarAdjDerivAt {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {Y : Type u_2} [NormedAddCommGroup Y] [NormedSpace Y] [MeasureTheory.MeasureSpace Y] {U : Type u_3} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_4} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] (F : (XU)YV) (F' : (YV)XU) (u : XU) :

This is analogue of saying F' = (fderiv ℝ F u).adjoint.

This definition is useful as we can prove composition theorem for it and HasVarGradient F grad u can be computed by grad := F' (fun _ => 1).

Instances For
    theorem HasVarAdjDerivAt.apply_smooth_of_smooth {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F : (XU)XV} {F' : (XV)XU} {u v : XU} (h : HasVarAdjDerivAt F F' u) (hv : ContDiff (↑) v) :
    ContDiff (↑) (F v)
    theorem HasVarAdjDerivAt.apply_smooth_self {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F : (XU)XV} {F' : (XV)XU} {u : XU} (h : HasVarAdjDerivAt F F' u) :
    ContDiff (↑) (F u)
    theorem HasVarAdjDerivAt.smooth_R {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F : (XU)XV} {F' : (XV)XU} {u : XU} (h : HasVarAdjDerivAt F F' u) {φ : XU} ( : ContDiff φ) (x : X) :
    ContDiff fun (s : ) => F (fun (x' : X) => φ s x') x
    theorem HasVarAdjDerivAt.smooth_linear {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {x : X} {F : (XU)XV} {F' : (XV)XU} {u : XU} (h : HasVarAdjDerivAt F F' u) {φ : XU} ( : ContDiff φ) :
    ContDiff fun (s' : ) => F (fun (x : X) => φ 0 x + s' deriv (fun (x_1 : ) => φ x_1 x) 0) x
    theorem HasVarAdjDerivAt.smooth_adjoint {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F : (XU)XV} {F' : (XV)XU} {u : XU} (h : HasVarAdjDerivAt F F' u) {δu : XU} (h' : ContDiff (↑) δu) (x : X) :
    ContDiff fun (s : ) => F (fun (x' : X) => u x' + s δu x') x
    theorem HasVarAdjDerivAt.differentiable_linear {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F : (XU)XV} {F' : (XV)XU} {u : XU} (h : HasVarAdjDerivAt F F' u) {φ : XU} ( : ContDiff φ) (x : X) :
    Differentiable fun (s' : ) => F (fun (x : X) => φ 0 x + s' deriv (fun (x_1 : ) => φ x_1 x) 0) x
    theorem HasVarAdjDerivAt.linearize_of_linear {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] {F : (XU)XV} (add : ∀ (φ1 φ2 : XU), ContDiff (↑) φ1ContDiff (↑) φ2F (φ1 + φ2) = F φ1 + F φ2) (smul : ∀ (c : ) (φ : XU), ContDiff (↑) φF (c φ) = c F φ) (deriv_comm : ∀ {φ : XU}, ContDiff φ∀ (x : X), deriv (fun (s' : ) => F (φ s') x) 0 = F (fun (x' : X) => deriv (fun (x : ) => φ x x') 0) x) {φ : XU} ( : ContDiff φ) (x : X) :
    deriv (fun (s' : ) => F (φ s') x) 0 = deriv (fun (s' : ) => F (fun (x' : X) => φ 0 x' + s' deriv (fun (x : ) => φ x x') 0) x) 0
    theorem HasVarAdjDerivAt.deriv_adjoint_of_linear {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F' : (XV)XU} {F : (XU)XV} (add : ∀ (φ1 φ2 : XU), ContDiff (↑) φ1ContDiff (↑) φ2F (φ1 + φ2) = F φ1 + F φ2) (smul : ∀ (c : ) (φ : XU), ContDiff (↑) φF (c φ) = c F φ) (u : XU) (smooth : ContDiff (↑) u) (h : HasVarAdjoint F F') :
    HasVarAdjoint (fun (δu : XU) (x : X) => deriv (fun (s : ) => F (fun (x' : X) => u x' + s δu x') x) 0) F'
    theorem HasVarAdjDerivAt.hasVarAdjDerivAt_of_hasVarAdjoint_of_linear {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {F' : (XV)XU} {F : (XU)XV} (diff : ∀ (φ : XU), ContDiff φContDiff fun (sx : × X) => F (φ sx.1) sx.2) (add : ∀ (φ1 φ2 : XU), ContDiff (↑) φ1ContDiff (↑) φ2F (φ1 + φ2) = F φ1 + F φ2) (smul : ∀ (c : ) (φ : XU), ContDiff (↑) φF (c φ) = c F φ) (deriv_comm : ∀ {φ : XU}, ContDiff φ∀ (x : X), deriv (fun (s' : ) => F (φ s') x) 0 = F (fun (x' : X) => deriv (fun (x : ) => φ x x') 0) x) (u : XU) (smooth : ContDiff (↑) u) (h : HasVarAdjoint F F') :
    theorem HasVarAdjDerivAt.id {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] (u : XU) (hu : ContDiff (↑) u) :
    HasVarAdjDerivAt (fun (φ : XU) => φ) (fun (ψ : XU) => ψ) u
    theorem HasVarAdjDerivAt.const {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] (u : XU) (v : XV) (hu : ContDiff (↑) u) (hv : ContDiff (↑) v) :
    HasVarAdjDerivAt (fun (x : XU) => v) (fun (x : XV) => 0) u
    theorem HasVarAdjDerivAt.comp {X : Type u_5} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {Y : Type u_1} [NormedAddCommGroup Y] [NormedSpace Y] [MeasureTheory.MeasureSpace Y] {Z : Type u_2} [NormedAddCommGroup Z] [NormedSpace Z] [MeasureTheory.MeasureSpace Z] {U : Type u_6} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {W : Type u_4} [NormedAddCommGroup W] [NormedSpace W] [InnerProductSpace' W] {F : (YV)ZW} {G : (XU)YV} {u : XU} {F' : (ZW)YV} {G' : (YV)XU} (hF : HasVarAdjDerivAt F F' (G u)) (hG : HasVarAdjDerivAt G G' u) :
    HasVarAdjDerivAt (fun (u : XU) => F (G u)) (fun (ψ : ZW) => G' (F' ψ)) u
    theorem HasVarAdjDerivAt.prod {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {W : Type u_4} [NormedAddCommGroup W] [NormedSpace W] [InnerProductSpace' W] {u : XU} [OpensMeasurableSpace X] [MeasureTheory.IsFiniteMeasureOnCompacts MeasureTheory.volume] {F : (XU)XV} {G : (XU)XW} {F' : (XV)XU} {G' : (XW)XU} (hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt G G' u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => (F φ x, G φ x)) (fun (φ : XV × W) (x : X) => F' (fun (x' : X) => (φ x').1) x + G' (fun (x' : X) => (φ x').2) x) u
    theorem HasVarAdjDerivAt.fst {X : Type u_3} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_4} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_2} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {W : Type u_1} [NormedAddCommGroup W] [NormedSpace W] [InnerProductSpace' W] {F' : (XW × V)XU} {u : XU} {F : (XU)XW × V} (hF : HasVarAdjDerivAt F F' u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => (F φ x).1) (fun (φ : XW) (x : X) => F' (fun (x' : X) => (φ x', 0)) x) u
    theorem HasVarAdjDerivAt.snd {X : Type u_3} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_4} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_2} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] {W : Type u_1} [NormedAddCommGroup W] [NormedSpace W] [InnerProductSpace' W] {F' : (XW × V)XU} {u : XU} {F : (XU)XW × V} (hF : HasVarAdjDerivAt F F' u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => (F φ x).2) (fun (φ : XV) (x : X) => F' (fun (x' : X) => (0, φ x')) x) u
    theorem HasVarAdjDerivAt.deriv' {U : Type u_1} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] (u : U) (hu : ContDiff (↑) u) :
    HasVarAdjDerivAt (fun (φ : U) => deriv φ) (fun (φ : U) (x : ) => -deriv φ x) u
    theorem HasVarAdjDerivAt.deriv {U : Type u_1} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_2} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] (F : (U)V) (F' : (V)U) (u : U) (hF : HasVarAdjDerivAt F F' u) :
    HasVarAdjDerivAt (fun (φ : U) => deriv (F φ)) (fun (ψ : V) (x : ) => F' (fun (x' : ) => -deriv ψ x') x) u
    theorem HasVarAdjDerivAt.fmap {X : Type u_3} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_1} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_2} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] [CompleteSpace U] [CompleteSpace V] (f : XUV) {f' : XUVU} (u : XU) (hu : ContDiff (↑) u) (hf' : ContDiff f) (hf : ∀ (x : X) (u : U), HasAdjFDerivAt (f x) (f' x u) u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => f x (φ x)) (fun (ψ : XV) (x : X) => f' x (u x) (ψ x)) u
    theorem HasVarAdjDerivAt.neg {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] (F : (XU)XV) (F' : (XV)XU) (u : XU) (hF : HasVarAdjDerivAt F F' u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => -F φ x) (fun (ψ : XV) (x : X) => -F' ψ x) u
    theorem HasVarAdjDerivAt.add {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] [OpensMeasurableSpace X] [MeasureTheory.IsFiniteMeasureOnCompacts MeasureTheory.volume] (F G : (XU)XV) (F' G' : (XV)XU) (u : XU) (hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt G G' u) :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => F φ x + G φ x) (fun (ψ : XV) (x : X) => F' ψ x + G' ψ x) u
    theorem HasVarAdjDerivAt.mul {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] [OpensMeasurableSpace X] [MeasureTheory.IsFiniteMeasureOnCompacts MeasureTheory.volume] (F G F' G' : (X)X) (u : X) (hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt G G' u) :
    HasVarAdjDerivAt (fun (φ : X) (x : X) => F φ x * G φ x) (fun (ψ : X) (x : X) => F' (fun (x' : X) => ψ x' * G u x') x + G' (fun (x' : X) => F u x' * ψ x') x) u
    theorem HasVarAdjDerivAt.fderiv {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] (u : XU) (dx : X) (hu : ContDiff (↑) u) [ProperSpace X] [BorelSpace X] [FiniteDimensional X] [MeasureTheory.volume.IsAddHaarMeasure] :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => (fderiv φ x) dx) (fun (ψ : XU) (x : X) => -(fderiv ψ x) dx) u
    theorem HasVarAdjDerivAt.fderiv' {X : Type u_1} [NormedAddCommGroup X] [NormedSpace X] [MeasureTheory.MeasureSpace X] {U : Type u_2} [NormedAddCommGroup U] [NormedSpace U] [InnerProductSpace' U] {V : Type u_3} [NormedAddCommGroup V] [NormedSpace V] [InnerProductSpace' V] (F : (XU)XV) (F' : (XV)XU) (u : XU) (dx : X) (hF : HasVarAdjDerivAt F F' u) [ProperSpace X] [BorelSpace X] [FiniteDimensional X] [MeasureTheory.volume.IsAddHaarMeasure] :
    HasVarAdjDerivAt (fun (φ : XU) (x : X) => (fderiv (F φ) x) dx) (fun (ψ : XV) (x : X) => F' (fun (x' : X) => -(fderiv ψ x') dx) x) u
    theorem HasVarAdjDerivAt.gradient {d : } (u : Space d) (hu : ContDiff (↑) u) :
    HasVarAdjDerivAt (fun (φ : Space d) (x : Space d) => gradient φ x) (fun (ψ : Space dSpace d) (x : Space d) => -Space.div ψ x) u
    theorem HasVarAdjDerivAt.div {d : } (u : Space dSpace d) (hu : ContDiff (↑) u) :
    HasVarAdjDerivAt (fun (φ : Space dSpace d) (x : Space d) => Space.div φ x) (fun (ψ : Space d) (x : Space d) => -gradient ψ x) u