Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1141ca3
fix imports and doc strings
lecopivo Jun 16, 2025
27b4ec7
refactor: Lint
jstoobysmith Jun 17, 2025
1ec2367
uniqueness of variational gradient
lecopivo Jun 19, 2025
953ed21
update docs string
lecopivo Jun 19, 2025
a8d24ee
fix mistakes while rebasing
lecopivo Jun 19, 2025
48846f1
fix white space
lecopivo Jun 19, 2025
ebb4cf9
use semiformal result
lecopivo Jun 19, 2025
27f0a82
remove test code
lecopivo Jun 19, 2025
8d69873
back to `proof_wanted`
lecopivo Jun 19, 2025
6dbbb62
fix linter and recover semiformal_result
lecopivo Jun 19, 2025
b786712
fix doc-string
lecopivo Jun 19, 2025
28deead
define variational adjoint derivative
lecopivo Jun 19, 2025
b78fbc3
refining proof of composition theorem
lecopivo Jun 19, 2025
3f549c4
proof of basic id, const and comp theorems for `HasVarAdjDerivAt`
lecopivo Jun 19, 2025
e2cd4b2
HasVarAdjDerivAt rules for deriv, neg, add, mul
lecopivo Jun 19, 2025
c3411dc
feat: Fill in sorries
jstoobysmith Jun 20, 2025
6ac35e4
small clean up
lecopivo Jun 20, 2025
df34bf6
added extensionality condition to `HasVarAdjoint`
lecopivo Jun 20, 2025
373c0f1
one last missin sorry
lecopivo Jun 20, 2025
cabc725
clear all sorry and add uniqueness of variational adjoint on smooth f…
lecopivo Jun 20, 2025
e607c70
fix linter
lecopivo Jun 20, 2025
7714057
Merge remote-tracking branch 'origin/master' into lecopivo/var_rev_deriv
lecopivo Jun 20, 2025
fe2dd25
fix formatting
lecopivo Jun 20, 2025
8ebbdcd
lint fix
lecopivo Jun 20, 2025
f6a0d3a
Merge branch 'lecopivo/var_adjoint_on_smooth' into lecopivo/var_gradi…
lecopivo Jun 20, 2025
e5fc016
merge changes from different branches
lecopivo Jun 20, 2025
1e389c2
fix proofs in HasVarAdjDerivAt
lecopivo Jun 20, 2025
c330594
remove unused code
lecopivo Jun 20, 2025
730bf7c
clean up HasVarGradient
lecopivo Jun 20, 2025
eab5851
Merge branch 'master' into lecopivo/var_gradient_refactor
lecopivo Jun 20, 2025
e4e5dbc
fix file renaming
lecopivo Jun 20, 2025
8ca495a
clean up the definition
lecopivo Jun 20, 2025
ece9e32
Merge branch 'lecopivo/var_gradient_refactor' into lecopivo/simplify_…
lecopivo Jun 20, 2025
b609192
fix binders
lecopivo Jun 20, 2025
a36deae
fix uniquness theorems
lecopivo Jun 20, 2025
edba411
Merge branch 'master' into pr/621
jstoobysmith Jun 21, 2025
46b9ce7
refactor: Lint
jstoobysmith Jun 21, 2025
63f26d5
refactor: LInt
jstoobysmith Jun 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions PhysLean/Mathematics/VariationalCalculus/HasVarAdjDeriv.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ open MeasureTheory ContDiff InnerProductSpace

variable
{X} [NormedAddCommGroup X] [NormedSpace ℝ X] [MeasureSpace X]
{Y} [NormedAddCommGroup Y] [NormedSpace ℝ Y] [MeasureSpace Y]
{Z} [NormedAddCommGroup Z] [NormedSpace ℝ Z] [MeasureSpace Z]
{U} [NormedAddCommGroup U] [InnerProductSpace ℝ U]
{V} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
{W} [NormedAddCommGroup W] [InnerProductSpace ℝ W]
Expand All @@ -34,11 +36,11 @@ variable

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)`. -/
structure HasVarAdjDerivAt (F : (X → U) → (X → V)) (F' : (X → V) → (X → U)) (u : X → U) : Prop
structure HasVarAdjDerivAt (F : (X → U) → (Y → V)) (F' : (Y → V) → (X → U)) (u : X → U) : Prop
where
smooth_at : ContDiff ℝ ∞ u
diff : ∀ (φ : ℝ → X → U), ContDiff ℝ ∞ ↿φ →
ContDiff ℝ ∞ (fun sx : ℝ×X => F (φ sx.1) sx.2)
ContDiff ℝ ∞ (fun sx : ℝ×Y => F (φ sx.1) sx.2)
linearize :
∀ (φ : ℝ → X → U), ContDiff ℝ ∞ ↿φ →
∀ x,
Expand Down Expand Up @@ -96,7 +98,7 @@ lemma const (u : X → U) (v : X → V) (hu : ContDiff ℝ ∞ u) (hv : ContDiff
linearize := by simp
adjoint := by simp; exact HasVarAdjoint.zero

lemma comp {F : (X → V) → (X → W)} {G : (X → U) → (X → V)} {u : X → U}
lemma comp {F : (Y → V) → (Z → W)} {G : (X → U) → (Y → V)} {u : X → U}
{F' G'} (hF : HasVarAdjDerivAt F F' (G u)) (hG : HasVarAdjDerivAt G G' u) :
HasVarAdjDerivAt (fun u => F (G u)) (fun ψ => G' (F' ψ)) u where
smooth_at := hG.smooth_at
Expand Down Expand Up @@ -126,19 +128,21 @@ lemma comp {F : (X → V) → (X → W)} {G : (X → U) → (X → V)} {u : X
lemma unique_on_test_functions
[IsFiniteMeasureOnCompacts (@volume X _)] [(@volume X _).IsOpenPosMeasure]
[OpensMeasurableSpace X]
(F : (X → U) → (X → V)) (u : X → U)
(F : (X → U) → (Y → V)) (u : X → U)
(F' G') (hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt F G' u)
(φ : X → V) (hφ : IsTestFunction φ) :
F' φ = G' φ := HasVarAdjoint.unique_on_test_functions (μ:=volume) hF.adjoint hG.adjoint φ hφ
(φ : Y → V) (hφ : IsTestFunction φ) :
F' φ = G' φ := HasVarAdjoint.unique_on_test_functions hF.adjoint hG.adjoint φ hφ

lemma unique {X : Type*} [NormedAddCommGroup X] [InnerProductSpace ℝ X]
[FiniteDimensional ℝ X] [MeasureSpace X] [OpensMeasurableSpace X]
[MeasureSpace X] [OpensMeasurableSpace X]
[IsFiniteMeasureOnCompacts (@volume X _)] [(@volume X _).IsOpenPosMeasure]
{F : (X → U) → (X → V)} {u : X → U}
{Y : Type*} [NormedAddCommGroup Y] [InnerProductSpace ℝ Y]
[FiniteDimensional ℝ Y] [MeasureSpace Y]
{F : (X → U) → (Y → V)} {u : X → U}
{F' G'} (hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt F G' u)
(φ : X → V) (hφ : ContDiff ℝ ∞ φ) :
(φ : Y → V) (hφ : ContDiff ℝ ∞ φ) :
F' φ = G' φ :=
HasVarAdjoint.unique (μ:=volume) hF.adjoint hG.adjoint φ hφ
HasVarAdjoint.unique hF.adjoint hG.adjoint φ hφ

attribute [fun_prop] differentiableAt_id'

Expand Down Expand Up @@ -202,9 +206,11 @@ lemma neg (F : (X → U) → (X → V)) (F') (u) (hF : HasVarAdjDerivAt F F' u)
apply HasVarAdjoint.neg
apply hF.adjoint

section OnFiniteMeasures

variable [OpensMeasurableSpace X] [IsFiniteMeasureOnCompacts (@volume X _)]

lemma add
[IsFiniteMeasureOnCompacts (@volume X _)]
[OpensMeasurableSpace X]
(F G : (X → U) → (X → V)) (F' G') (u)
(hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt G G' u) :
HasVarAdjDerivAt (fun φ x => F φ x + G φ x) (fun ψ x => F' ψ x + G' ψ x) u where
Expand Down Expand Up @@ -251,8 +257,6 @@ lemma add
apply hG.adjoint

lemma mul
[IsFiniteMeasureOnCompacts (@volume X _)]
[OpensMeasurableSpace X]
(F G : (X → ℝ) → (X → ℝ)) (F' G') (u)
(hF : HasVarAdjDerivAt F F' u) (hG : HasVarAdjDerivAt G G' u) :
HasVarAdjDerivAt (fun φ x => F φ x * G φ x)
Expand Down Expand Up @@ -302,3 +306,5 @@ lemma mul
· apply HasVarAdjoint.mul_left
apply hG.adjoint
exact apply_smooth_self hF

end OnFiniteMeasures
Loading