From 16f74e694e811a1d5bd93424ae1593aa6e6b1cf5 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 13 Sep 2026 14:54:52 +0100 Subject: [PATCH 01/11] feat(ClassicalMechanics): add the Poisson bracket - `poissonBracket`, antisymmetry, bilinearity in each argument, and `deriv_comp_eq_poissonBracket` connecting it to time evolution under Hamilton's equations. - `gradient_add` in `Physlib.Mathematics.Calculus.Gradient`, the missing additivity rule needed to prove bilinearity. Co-Authored-By: Claude Sonnet 5 Co-Authored-By: Claude Opus 5.5 --- Physlib.lean | 1 + .../ClassicalMechanics/PoissonBracket.lean | 199 ++++++++++++++++++ Physlib/Mathematics/Calculus/Gradient.lean | 19 +- 3 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 Physlib/ClassicalMechanics/PoissonBracket.lean diff --git a/Physlib.lean b/Physlib.lean index 3a15298bf2..04d92f1dea 100644 --- a/Physlib.lean +++ b/Physlib.lean @@ -33,6 +33,7 @@ public import Physlib.ClassicalMechanics.Pendulum.SimplePendulum.Solution public import Physlib.ClassicalMechanics.Pendulum.SlidingPendulum public import Physlib.ClassicalMechanics.PointParticle.Basic public import Physlib.ClassicalMechanics.PointParticle.NewtonianSystem.Basic +public import Physlib.ClassicalMechanics.PoissonBracket public import Physlib.ClassicalMechanics.RigidBody.AngularMomentum public import Physlib.ClassicalMechanics.RigidBody.AngularVelocity public import Physlib.ClassicalMechanics.RigidBody.Basic diff --git a/Physlib/ClassicalMechanics/PoissonBracket.lean b/Physlib/ClassicalMechanics/PoissonBracket.lean new file mode 100644 index 0000000000..0a8a805395 --- /dev/null +++ b/Physlib/ClassicalMechanics/PoissonBracket.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import Physlib.ClassicalMechanics.HamiltonsEquations +public import Physlib.Mathematics.Calculus.Gradient +/-! + +# The Poisson bracket + +## i. Overview + +The Poisson bracket packages, into a single antisymmetric bilinear operation on phase-space +functions, the way an observable evolves along a Hamiltonian flow. Following the convention of +`hamiltonEqOp` in `HamiltonsEquations.lean`, a phase-space function is a function `f : X → X → ℝ` +read as `f p q` for `p` a momentum and `q` a position, both valued in a real inner product space +`X`. The bracket of two such functions is + +$$\{f, g\} := \left\langle \frac{\partial f}{\partial q}, \frac{\partial g}{\partial p} + \right\rangle - \left\langle \frac{\partial f}{\partial p}, \frac{\partial g}{\partial q} + \right\rangle,$$ + +built from the same currying-and-`gradient` idiom `hamiltonEqOp` already uses to express partial +derivatives on phase space. + +## ii. Key results + +- `poissonBracket` : the Poisson bracket of two phase-space functions. +- `poissonBracket_antisymm` : the bracket is antisymmetric. +- `poissonBracket_add_left`, `poissonBracket_const_mul_left` : the bracket is additive and + homogeneous in its first argument (the right-argument versions follow by antisymmetry). +- `deriv_comp_eq_inner_gradient_add` : the time derivative of a phase-space function composed with + a trajectory is the sum of its gradients paired with the trajectory's velocities. +- `deriv_comp_eq_poissonBracket` : along a solution of Hamilton's equations, the time derivative of + an observable is its Poisson bracket with the Hamiltonian. + +## iii. Table of contents + +- A. The definition of the Poisson bracket +- B. Antisymmetry +- C. Bilinearity +- D. Time evolution along a Hamiltonian flow + - D.1. The chain rule for a phase-space function along a trajectory + - D.2. Time evolution as the Poisson bracket with the Hamiltonian + +## iv. References + +* G. J. Sussman and J. Wisdom, "Structure and Interpretation of Classical Mechanics", Section 3.2. + . + [ref: sussman_wisdom_sicm] +-/ + +@[expose] public section + +open InnerProductSpace Time + +namespace ClassicalMechanics + +variable {X} [NormedAddCommGroup X] [InnerProductSpace ℝ X] [CompleteSpace X] + +TODO "Add the canonical commutation relations for coordinate functionals, the Leibniz (product) + rule `{f, g * h} = {f, g} * h + g * {f, h}`, and the Jacobi identity for `poissonBracket`." + +/-! + +## A. The definition of the Poisson bracket + +-/ + +/-- The Poisson bracket of two phase-space functions `f g : X → X → ℝ`, each read as `f p q` for +a momentum `p` and a position `q`, at a point `(p, q)` of phase space. -/ +noncomputable def poissonBracket (f g : X → X → ℝ) (p q : X) : ℝ := + ⟪gradient (fun q' => f p q') q, gradient (fun p' => g p' q) p⟫_ℝ - + ⟪gradient (fun p' => f p' q) p, gradient (fun q' => g p q') q⟫_ℝ + +/-! + +## B. Antisymmetry + +-/ + +/-- The Poisson bracket is antisymmetric. -/ +lemma poissonBracket_antisymm (f g : X → X → ℝ) (p q : X) : + poissonBracket f g p q = -poissonBracket g f p q := by + simp only [poissonBracket, neg_sub] + rw [real_inner_comm (gradient (fun p' => g p' q) p) (gradient (fun q' => f p q') q), + real_inner_comm (gradient (fun q' => g p q') q) (gradient (fun p' => f p' q) p)] + +/-! + +## C. Bilinearity + +The bracket is additive and homogeneous under scaling by a constant in each argument. We prove +this for the first argument; the second-argument versions follow from `poissonBracket_antisymm`. + +-/ + +/-- The Poisson bracket is additive in its first argument, for functions differentiable in both +phase-space directions. -/ +lemma poissonBracket_add_left (f₁ f₂ g : X → X → ℝ) (p q : X) + (hf₁p : DifferentiableAt ℝ (fun p' => f₁ p' q) p) + (hf₂p : DifferentiableAt ℝ (fun p' => f₂ p' q) p) + (hf₁q : DifferentiableAt ℝ (fun q' => f₁ p q') q) + (hf₂q : DifferentiableAt ℝ (fun q' => f₂ p q') q) : + poissonBracket (fun p' q' => f₁ p' q' + f₂ p' q') g p q = + poissonBracket f₁ g p q + poissonBracket f₂ g p q := by + simp only [poissonBracket] + rw [gradient_add hf₁q hf₂q, gradient_add hf₁p hf₂p, inner_add_left, inner_add_left] + ring + +/-- The Poisson bracket is homogeneous of degree one in its first argument, for a function +differentiable in both phase-space directions. -/ +lemma poissonBracket_const_mul_left (c : ℝ) (f g : X → X → ℝ) (p q : X) + (hfp : DifferentiableAt ℝ (fun p' => f p' q) p) + (hfq : DifferentiableAt ℝ (fun q' => f p q') q) : + poissonBracket (fun p' q' => c * f p' q') g p q = c * poissonBracket f g p q := by + simp only [poissonBracket] + rw [gradient_const_mul c hfq, gradient_const_mul c hfp, inner_smul_left, inner_smul_left] + simp [mul_sub] + +/-- The Poisson bracket is additive in its second argument. -/ +lemma poissonBracket_add_right (f g₁ g₂ : X → X → ℝ) (p q : X) + (hg₁p : DifferentiableAt ℝ (fun p' => g₁ p' q) p) + (hg₂p : DifferentiableAt ℝ (fun p' => g₂ p' q) p) + (hg₁q : DifferentiableAt ℝ (fun q' => g₁ p q') q) + (hg₂q : DifferentiableAt ℝ (fun q' => g₂ p q') q) : + poissonBracket f (fun p' q' => g₁ p' q' + g₂ p' q') p q = + poissonBracket f g₁ p q + poissonBracket f g₂ p q := by + rw [poissonBracket_antisymm f, poissonBracket_add_left g₁ g₂ f p q hg₁p hg₂p hg₁q hg₂q, + poissonBracket_antisymm g₁ f, poissonBracket_antisymm g₂ f] + ring + +/-- The Poisson bracket is homogeneous of degree one in its second argument. -/ +lemma poissonBracket_const_mul_right (c : ℝ) (f g : X → X → ℝ) (p q : X) + (hgp : DifferentiableAt ℝ (fun p' => g p' q) p) + (hgq : DifferentiableAt ℝ (fun q' => g p q') q) : + poissonBracket f (fun p' q' => c * g p' q') p q = c * poissonBracket f g p q := by + rw [poissonBracket_antisymm f, poissonBracket_const_mul_left c g f p q hgp hgq, + poissonBracket_antisymm g f] + ring + +/-! + +## D. Time evolution along a Hamiltonian flow + +-/ + +/-! + +### D.1. The chain rule for a phase-space function along a trajectory + +-/ + +/-- The time derivative of a phase-space function `f` composed with trajectories `p q : Time → X` +is the sum of the gradients of `f` paired with the velocities `∂ₜ p` and `∂ₜ q`. -/ +theorem deriv_comp_eq_inner_gradient_add (f : X → X → ℝ) (p q : Time → X) (t : Time) + (hp : DifferentiableAt ℝ p t) (hq : DifferentiableAt ℝ q t) + (hf : DifferentiableAt ℝ (Function.uncurry f) (p t, q t)) : + ∂ₜ (fun t => f (p t) (q t)) t = + ⟪gradient (fun p' => f p' (q t)) (p t), ∂ₜ p t⟫_ℝ + + ⟪gradient (fun q' => f (p t) q') (q t), ∂ₜ q t⟫_ℝ := by + have h1 : HasFDerivAt (fun p' => f p' (q t)) + ((fderiv ℝ (Function.uncurry f) (p t, q t)).comp (ContinuousLinearMap.inl ℝ X X)) (p t) := + HasFDerivAt.comp (f := fun e : X => (e, q t)) (p t) hf.hasFDerivAt + (hasFDerivAt_prodMk_left (p t) (q t)) + have h2 : HasFDerivAt (fun q' => f (p t) q') + ((fderiv ℝ (Function.uncurry f) (p t, q t)).comp (ContinuousLinearMap.inr ℝ X X)) (q t) := + HasFDerivAt.comp (f := fun e : X => (p t, e)) (q t) hf.hasFDerivAt + (hasFDerivAt_prodMk_right (p t) (q t)) + have hF : HasFDerivAt (fun t => f (p t) (q t)) + ((fderiv ℝ (Function.uncurry f) (p t, q t)).comp ((fderiv ℝ p t).prod (fderiv ℝ q t))) t := + HasFDerivAt.comp (f := fun t => (p t, q t)) t hf.hasFDerivAt + (hp.hasFDerivAt.prodMk hq.hasFDerivAt) + rw [inner_gradient_left, inner_gradient_left, h1.fderiv, h2.fderiv, Time.deriv_eq, hF.fderiv] + simp [ContinuousLinearMap.comp_apply, ContinuousLinearMap.prod_apply, + ContinuousLinearMap.inl_apply, ContinuousLinearMap.inr_apply, ← Time.deriv_eq, ← map_add] + +/-! + +### D.2. Time evolution as the Poisson bracket with the Hamiltonian + +-/ + +/-- Along a solution of Hamilton's equations for a Hamiltonian `H`, the time derivative of a +phase-space observable `f` is its Poisson bracket with `H t`. -/ +theorem deriv_comp_eq_poissonBracket (H : Time → X → X → ℝ) (p q : Time → X) (f : X → X → ℝ) + (t : Time) (heq : hamiltonEqOp H p q = 0) + (hp : DifferentiableAt ℝ p t) (hq : DifferentiableAt ℝ q t) + (hf : DifferentiableAt ℝ (Function.uncurry f) (p t, q t)) : + ∂ₜ (fun t => f (p t) (q t)) t = poissonBracket f (H t) (p t) (q t) := by + obtain ⟨hq', hp'⟩ := (hamiltonEqOp_eq_zero_iff_hamiltons_equations H p q).mp heq + rw [deriv_comp_eq_inner_gradient_add f p q t hp hq hf, hq' t, hp' t, inner_neg_right] + unfold poissonBracket + ring + +end ClassicalMechanics diff --git a/Physlib/Mathematics/Calculus/Gradient.lean b/Physlib/Mathematics/Calculus/Gradient.lean index ece9e748e6..15e4d7c150 100644 --- a/Physlib/Mathematics/Calculus/Gradient.lean +++ b/Physlib/Mathematics/Calculus/Gradient.lean @@ -16,9 +16,10 @@ public import Mathlib.Analysis.InnerProductSpace.Calculus Mathlib defines the gradient `∇ f x` of a real-valued function on a real Hilbert space as the Riesz representative of its Fréchet derivative, but records no rules for the algebraic operations on `f` beyond constants. This file collects the elementary rules used throughout the classical -mechanics of Physlib: a gradient is unchanged by adding a constant, it commutes with -multiplication by a constant, the gradient of the quadratic form `⟪y, y⟫` is `2 • y`, and the -gradient of a coordinate functional on Euclidean space is the corresponding basis vector. +mechanics of Physlib: a gradient is unchanged by adding a constant, it is additive over +differentiable functions, it commutes with multiplication by a constant, the gradient of the +quadratic form `⟪y, y⟫` is `2 • y`, and the gradient of a coordinate functional on Euclidean space +is the corresponding basis vector. These are the rules needed to differentiate Lagrangians and Hamiltonians of the form `kinetic − potential` with respect to positions and velocities. @@ -33,6 +34,7 @@ product space. The file is deliberately real: two of its rules (`gradient_const_ ## ii. Key results - `gradient_add_const` : `∇ (f + c) = ∇ f`. +- `gradient_add` : `∇ (f + g) = ∇ f + ∇ g` for differentiable `f` and `g`. - `gradient_const_mul` : `∇ (c * f) = c • ∇ f` for differentiable `f`. - `gradient_inner_self` : `∇ (fun y => ⟪y, y⟫) x = 2 • x`. - `gradient_const_mul_inner_self` : `∇ (fun y => c * ⟪y, y⟫) x = (2 * c) • x`. @@ -63,8 +65,8 @@ variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [CompleteS ## A. Gradients and constants -Adding a constant does not change the Fréchet derivative, hence not the gradient; multiplying by a -constant scales both. +Adding a constant does not change the Fréchet derivative, hence not the gradient; the gradient is +additive over differentiable functions, and multiplying by a constant scales it. -/ @@ -74,6 +76,13 @@ lemma gradient_add_const {f : F → ℝ} (c : ℝ) (x : F) : unfold gradient rw [fderiv_add_const] +/-- The gradient of a sum of differentiable functions is the sum of their gradients. -/ +lemma gradient_add {f g : F → ℝ} {x : F} (hf : DifferentiableAt ℝ f x) + (hg : DifferentiableAt ℝ g x) : + gradient (fun y => f y + g y) x = gradient f x + gradient g x := by + unfold gradient + rw [fderiv_fun_add hf hg, map_add] + /-- The gradient of a constant multiple of a differentiable function is the constant multiple of the gradient. -/ lemma gradient_const_mul {f : F → ℝ} {x : F} (c : ℝ) (hf : DifferentiableAt ℝ f x) : From b38cf4f05c1339595847c5566f2cadff19a45287 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 27 Sep 2026 00:08:40 +0100 Subject: [PATCH 02/11] feat(PhyslibAlpha): Liouville integrable systems - `poissonBracket_self`, the Poisson bracket of a function with itself vanishes, and `poissonBracket_eq_of_hasGradientAt`, the bracket of two functions with known partial gradients. - `LiouvilleIntegrableOn U H`, a Hamiltonian system with `d` smooth conserved quantities, one of them the Hamiltonian, which are in involution and functionally independent on an open dense domain `U` of phase space. - `LiouvilleIntegrableOn.deriv_comp_eq_zero`, each conserved quantity is constant along a solution of Hamilton's equations in `U`. - `LiouvilleIntegrableOn.oneDegreeOfFreedom`, a system with one degree of freedom is Liouville integrable wherever its Hamiltonian is smooth with non-vanishing gradient. Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 2 + .../LiouvilleIntegrable/Basic.lean | 158 ++++++++++++++++++ .../PoissonBracket/Basic.lean | 64 +++++++ 3 files changed, 224 insertions(+) create mode 100644 PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean create mode 100644 PhyslibAlpha/ClassicalMechanics/PoissonBracket/Basic.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index 95e3902f32..eeca41247e 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -21,6 +21,7 @@ public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergence public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergenceEquivalence public import PhyslibAlpha.ClassicalFieldTheory.Local.Variation public import PhyslibAlpha.ClassicalMechanics.CoupledSpringPotential +public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Cohomology public import PhyslibAlpha.ClassicalMechanics.MomentMap.GalileanMass @@ -33,6 +34,7 @@ public import PhyslibAlpha.ClassicalMechanics.NortonDome.PhysicalSpace public import PhyslibAlpha.ClassicalMechanics.NortonDome.PosPartPow public import PhyslibAlpha.ClassicalMechanics.NortonDome.Solution public import PhyslibAlpha.ClassicalMechanics.NortonDome.Sqrt +public import PhyslibAlpha.ClassicalMechanics.PoissonBracket.Basic public import PhyslibAlpha.CondensedMatter.TightBindingChain.OpenBoundary public import PhyslibAlpha.CondensedMatter.TightBindingChain.Uncertainty public import PhyslibAlpha.Mathematics.Analysis.Normed.HolderDual diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean new file mode 100644 index 0000000000..872f47aeb1 --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean @@ -0,0 +1,158 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import PhyslibAlpha.ClassicalMechanics.PoissonBracket.Basic +public import Mathlib.Analysis.InnerProductSpace.PiL2 +public import Mathlib.LinearAlgebra.LinearIndependent.Basic +/-! + +# Liouville integrable systems + +## i. Overview + +A Hamiltonian system on a `2d`-dimensional phase space is *Liouville integrable* when it carries +`d` conserved quantities, one per degree of freedom, that are + +- smooth, +- pairwise Poisson-commuting ("in involution"), and +- functionally independent, i.e. their phase-space gradients are linearly independent. + +Functional independence cannot hold at every point of phase space in any interesting example: the +gradient of the Hamiltonian of the harmonic oscillator vanishes at the equilibrium, and the Kepler +Hamiltonian is singular at the origin of position space. The definition therefore asks for the +conditions on an open *domain* `U` of phase space, which must be dense so that the conditions hold +generically. Without density the empty domain would make every Hamiltonian integrable. + +This is the hypothesis of the Liouville–Arnold theorem, which further concludes the existence of +action-angle coordinates and invariant tori for the motion; that conclusion is not formalized here +(see the `TODO` below). What is formalized is the definition itself, together with its immediate +consequence: each of the `d` conserved quantities really is conserved along the Hamiltonian flow +inside `U`, by reducing to `deriv_comp_eq_poissonBracket` from +`Physlib.ClassicalMechanics.PoissonBracket`. + +With one degree of freedom the conditions collapse: the Hamiltonian is the only conserved quantity, +involution is automatic, and independence says only that the gradient of the Hamiltonian does not +vanish. `LiouvilleIntegrableOn.oneDegreeOfFreedom` records this, and is how the harmonic oscillator +and the simple pendulum are shown to be integrable. + +Following the convention of `poissonBracket`, a phase-space function `f : X → X → ℝ` is read as +`f p q` for a momentum `p` and a position `q`. Since PhysLib has no existing precedent for a +`FiniteDimensional`/`Module.finrank` hypothesis on an abstract phase space, position space is fixed +concretely as `EuclideanSpace ℝ (Fin d)` for an explicit `d : ℕ`, matching the indexing convention +already used for e.g. `RigidBody (d : ℕ)`. + +## ii. Key results + +- `LiouvilleIntegrableOn` : the structure of a Liouville integrable system for a Hamiltonian `H` + on an open dense domain `U` of phase space. +- `LiouvilleIntegrableOn.deriv_comp_eq_zero` : each conserved quantity has zero time derivative + along a solution of Hamilton's equations for `H` which stays in `U`. +- `LiouvilleIntegrableOn.oneDegreeOfFreedom` : a system with one degree of freedom is Liouville + integrable wherever its Hamiltonian is smooth with non-vanishing gradient. + +## iii. Table of contents + +- A. The definition of Liouville integrability +- B. Conservation along the flow +- C. Systems with one degree of freedom + +## iv. References + +* V. I. Arnold, *Mathematical Methods of Classical Mechanics*, 2nd edition, Chapter 10. +-/ + +@[expose] public section + +namespace ClassicalMechanics + +open Time +open scoped ContDiff + +TODO "Formalize the conclusion of the Liouville–Arnold theorem (action-angle coordinates, + invariant tori) — the definition here is only its hypothesis." + +/-! + +## A. The definition of Liouville integrability + +-/ + +/-- A Liouville integrable system for a Hamiltonian `H` on an open dense domain `U` of the +`2d`-dimensional phase space `EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d)`, whose points +are read as `(p, q)`: `d` smooth conserved quantities, one per degree of freedom, that are pairwise +in involution and functionally independent at every point of `U`. -/ +structure LiouvilleIntegrableOn {d : ℕ} + (U : Set (EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d))) + (H : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d) → ℝ) where + /-- The domain on which the system is integrable is open. -/ + isOpen : IsOpen U + /-- The domain on which the system is integrable is dense, i.e. integrability holds + generically. -/ + dense : Dense U + /-- The `d` conserved quantities, one per degree of freedom. -/ + f : Fin d → EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d) → ℝ + /-- The conserved quantities are smooth on `U`. -/ + contDiffOn : ∀ i, ContDiffOn ℝ ∞ (Function.uncurry (f i)) U + /-- The Hamiltonian itself is one of the conserved quantities. -/ + exists_hamiltonian : ∃ i, f i = H + /-- The conserved quantities pairwise Poisson-commute on `U`, i.e. are in involution. -/ + involutive : ∀ i j, ∀ x ∈ U, poissonBracket (f i) (f j) x.1 x.2 = 0 + /-- The conserved quantities are functionally independent on `U`: their phase-space gradients + (the `p`- and `q`-partials together) are linearly independent. -/ + independent : ∀ x ∈ U, LinearIndependent ℝ + (fun i => (gradient (fun p' => f i p' x.2) x.1, gradient (fun q' => f i x.1 q') x.2)) + +/-! + +## B. Conservation along the flow + +-/ + +/-- Each conserved quantity of a Liouville integrable system has zero time derivative along a +solution of Hamilton's equations for `H` which lies in the domain `U` at time `t`. -/ +lemma LiouvilleIntegrableOn.deriv_comp_eq_zero {d : ℕ} + {U : Set (EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d))} + {H : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d) → ℝ} + (LI : LiouvilleIntegrableOn U H) + (p q : Time → EuclideanSpace ℝ (Fin d)) (t : Time) (i : Fin d) + (heq : hamiltonEqOp (fun _ => H) p q = 0) + (hp : DifferentiableAt ℝ p t) (hq : DifferentiableAt ℝ q t) (hU : (p t, q t) ∈ U) : + ∂ₜ (fun t => LI.f i (p t) (q t)) t = 0 := by + obtain ⟨i₀, hi₀⟩ := LI.exists_hamiltonian + have hf : DifferentiableAt ℝ (Function.uncurry (LI.f i)) (p t, q t) := + ((LI.contDiffOn i).contDiffAt (LI.isOpen.mem_nhds hU)).differentiableAt (by simp) + have hderiv := deriv_comp_eq_poissonBracket (fun _ => H) p q (LI.f i) t heq hp hq hf + have hinv := LI.involutive i i₀ (p t, q t) hU + rw [hi₀] at hinv + rw [hderiv] + exact hinv + +/-! + +## C. Systems with one degree of freedom + +-/ + +/-- A Hamiltonian system with one degree of freedom is Liouville integrable, with the Hamiltonian as +its single conserved quantity, on any open dense domain on which the Hamiltonian is smooth and has +non-vanishing phase-space gradient. -/ +def LiouvilleIntegrableOn.oneDegreeOfFreedom + {U : Set (EuclideanSpace ℝ (Fin 1) × EuclideanSpace ℝ (Fin 1))} + {H : EuclideanSpace ℝ (Fin 1) → EuclideanSpace ℝ (Fin 1) → ℝ} + (hU : IsOpen U) (hdense : Dense U) (hH : ContDiffOn ℝ ∞ (Function.uncurry H) U) + (hgrad : ∀ x ∈ U, + (gradient (fun p' => H p' x.2) x.1, gradient (fun q' => H x.1 q') x.2) ≠ 0) : + LiouvilleIntegrableOn U H where + isOpen := hU + dense := hdense + f := fun _ => H + contDiffOn := fun _ => hH + exists_hamiltonian := ⟨0, rfl⟩ + involutive := fun _ _ _ _ => poissonBracket_self _ _ _ + independent := fun x hx => linearIndependent_unique_iff.mpr (hgrad x hx) + +end ClassicalMechanics diff --git a/PhyslibAlpha/ClassicalMechanics/PoissonBracket/Basic.lean b/PhyslibAlpha/ClassicalMechanics/PoissonBracket/Basic.lean new file mode 100644 index 0000000000..0c4db17990 --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/PoissonBracket/Basic.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import Physlib.ClassicalMechanics.PoissonBracket +/-! + +# Computing Poisson brackets + +## i. Overview + +Further properties of `poissonBracket` from `Physlib.ClassicalMechanics.PoissonBracket`, used to +compute the brackets between the conserved quantities of Hamiltonian systems: the bracket of a +function with itself vanishes, and the bracket of two functions whose partial gradients are known, +in the form of `HasGradientAt` statements, is given explicitly by those gradients. + +## ii. Key results + +- `poissonBracket_self` : every phase-space function Poisson-commutes with itself. +- `poissonBracket_eq_of_hasGradientAt` : the Poisson bracket in terms of known partial gradients. + +## iii. Table of contents + +- A. The bracket of a function with itself +- B. The bracket from known gradients +-/ + +@[expose] public section + +open InnerProductSpace + +namespace ClassicalMechanics + +variable {X} [NormedAddCommGroup X] [InnerProductSpace ℝ X] [CompleteSpace X] + +/-! + +## A. The bracket of a function with itself + +-/ + +/-- The Poisson bracket of a phase-space function with itself vanishes. -/ +lemma poissonBracket_self (f : X → X → ℝ) (p q : X) : poissonBracket f f p q = 0 := by + have h := poissonBracket_antisymm f f p q + linarith + +/-! + +## B. The bracket from known gradients + +-/ + +/-- The Poisson bracket of two phase-space functions whose partial gradients at `(p, q)` are +known. -/ +lemma poissonBracket_eq_of_hasGradientAt {f g : X → X → ℝ} {p q fp fq gp gq : X} + (hfp : HasGradientAt (fun p' => f p' q) fp p) (hfq : HasGradientAt (fun q' => f p q') fq q) + (hgp : HasGradientAt (fun p' => g p' q) gp p) (hgq : HasGradientAt (fun q' => g p q') gq q) : + poissonBracket f g p q = ⟪fq, gp⟫_ℝ - ⟪fp, gq⟫_ℝ := by + rw [poissonBracket, hfq.gradient, hgp.gradient, hfp.gradient, hgq.gradient] + +end ClassicalMechanics From cbd88d2642cf55199a54ffcaf3c82626a413abf0 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 27 Sep 2026 00:07:15 +0100 Subject: [PATCH 03/11] feat(PhyslibAlpha): calculus rules for HasGradientAt - `HasGradientAt.add`, `HasGradientAt.sub`, `HasGradientAt.mul`, `HasGradientAt.const_mul`, the algebraic rules for gradients. - `HasDerivAt.comp_hasGradientAt`, the chain rule for a real function of a real-valued function. - `hasGradientAt_inner_left`, `hasGradientAt_inner_right`, `hasGradientAt_inner_self`, `hasGradientAt_norm`, `hasGradientAt_coord`, the gradients of scalar products, of the norm away from the origin, and of coordinate functionals on Euclidean space. Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 1 + PhyslibAlpha/Mathematics/HasGradient.lean | 161 ++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 PhyslibAlpha/Mathematics/HasGradient.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index eeca41247e..3a56567893 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -66,6 +66,7 @@ public import PhyslibAlpha.Mathematics.Order.PositiveDual.RieszKantorovich public import PhyslibAlpha.Mathematics.Order.PositiveDual.UpperEnvelope public import PhyslibAlpha.Mathematics.Order.StrongUnit public import PhyslibAlpha.Mathematics.Order.VectorLattice +public import PhyslibAlpha.Mathematics.HasGradient public import PhyslibAlpha.Mathematics.PartialDerivativeTest public import PhyslibAlpha.Mathematics.Probability.Kernel.Factorization public import PhyslibAlpha.Mathematics.Sublinear diff --git a/PhyslibAlpha/Mathematics/HasGradient.lean b/PhyslibAlpha/Mathematics/HasGradient.lean new file mode 100644 index 0000000000..792b52ae6e --- /dev/null +++ b/PhyslibAlpha/Mathematics/HasGradient.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import Mathlib.Analysis.Calculus.Gradient.Basic +public import Mathlib.Analysis.InnerProductSpace.Calculus +public import Mathlib.Analysis.SpecialFunctions.Sqrt +public import Physlib.Mathematics.Calculus.Gradient +/-! + +# Calculus rules for `HasGradientAt` + +## i. Overview + +Mathlib defines `HasGradientAt f f' x`, that `f'` is the gradient of `f` at `x`, but records no +rules for building it from simpler functions. This file records the rules for sums, differences, +products, and composition with a real function, together with the basic gradients on a real inner +product space: those of `y ↦ ⟪a, y⟫`, `y ↦ ⟪y, a⟫`, `y ↦ ⟪y, y⟫` and `y ↦ ‖y‖`, and that of a +coordinate functional on Euclidean space. + +Stating gradients as `HasGradientAt` rather than computing `gradient` directly establishes +differentiability and the value of the gradient together. This is how the gradients of the +conserved quantities of central-force systems, built from `⟪p, p⟫`, `⟪q, q⟫`, `⟪q, p⟫` and `‖q‖`, +are computed. + +## ii. Key results + +- `HasGradientAt.add`, `HasGradientAt.sub`, `HasGradientAt.mul`, `HasGradientAt.const_mul` : the + algebraic rules. +- `HasDerivAt.comp_hasGradientAt` : the chain rule for a real function of a real-valued function. +- `hasGradientAt_inner_left`, `hasGradientAt_inner_right`, `hasGradientAt_inner_self`, + `hasGradientAt_norm`, `hasGradientAt_coord` : the basic gradients. + +## iii. Table of contents + +- A. Algebraic rules +- B. The chain rule +- C. Basic gradients + - C.1. Scalar products + - C.2. The norm + - C.3. Coordinate functionals on Euclidean space + +## iv. References + +* Mathlib, `Mathlib.Analysis.Calculus.Gradient.Basic`. +-/ + +@[expose] public section + +open InnerProductSpace + +variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [CompleteSpace F] + {f g : F → ℝ} {f' g' : F} {x : F} + +/-! + +## A. Algebraic rules + +-/ + +/-- The gradient of a sum is the sum of the gradients. -/ +lemma HasGradientAt.add (hf : HasGradientAt f f' x) (hg : HasGradientAt g g' x) : + HasGradientAt (fun y => f y + g y) (f' + g') x := by + rw [hasGradientAt_iff_hasFDerivAt] at * + simp only [map_add] + exact hf.add hg + +/-- The gradient of a difference is the difference of the gradients. -/ +lemma HasGradientAt.sub (hf : HasGradientAt f f' x) (hg : HasGradientAt g g' x) : + HasGradientAt (fun y => f y - g y) (f' - g') x := by + rw [hasGradientAt_iff_hasFDerivAt] at * + simp only [map_sub] + exact hf.sub hg + +/-- The gradient of a product is given by the Leibniz rule. -/ +lemma HasGradientAt.mul (hf : HasGradientAt f f' x) (hg : HasGradientAt g g' x) : + HasGradientAt (fun y => f y * g y) (f x • g' + g x • f') x := by + rw [hasGradientAt_iff_hasFDerivAt] at * + simp only [map_add, map_smul] + exact hf.mul hg + +/-- The gradient of a constant multiple is the constant multiple of the gradient. -/ +lemma HasGradientAt.const_mul (c : ℝ) (hf : HasGradientAt f f' x) : + HasGradientAt (fun y => c * f y) (c • f') x := by + rw [hasGradientAt_iff_hasFDerivAt] at * + simp only [map_smul] + exact hf.const_mul c + +/-! + +## B. The chain rule + +-/ + +/-- The chain rule: the gradient of `y ↦ φ (f y)` is `φ'` times the gradient of `f`, for `φ'` the +derivative of `φ` at `f x`. -/ +lemma HasDerivAt.comp_hasGradientAt {φ : ℝ → ℝ} {φ' : ℝ} (hf : HasGradientAt f f' x) + (hφ : HasDerivAt φ φ' (f x)) : HasGradientAt (fun y => φ (f y)) (φ' • f') x := by + rw [hasGradientAt_iff_hasFDerivAt] at * + simp only [map_smul] + exact hφ.comp_hasFDerivAt x hf + +/-! + +## C. Basic gradients + +-/ + +/-! + +### C.1. Scalar products + +-/ + +/-- The gradient of `y ↦ ⟪a, y⟫` is `a`. -/ +lemma hasGradientAt_inner_left (a x : F) : HasGradientAt (fun y : F => ⟪a, y⟫_ℝ) a x := by + rw [hasGradientAt_iff_hasFDerivAt] + exact (toDual ℝ F a).hasFDerivAt + +/-- The gradient of `y ↦ ⟪y, a⟫` is `a`. -/ +lemma hasGradientAt_inner_right (a x : F) : HasGradientAt (fun y : F => ⟪y, a⟫_ℝ) a x := by + simp_rw [real_inner_comm a] + exact hasGradientAt_inner_left a x + +/-- The gradient of `y ↦ ⟪y, y⟫` is `2 • y`. -/ +lemma hasGradientAt_inner_self (x : F) : HasGradientAt (fun y : F => ⟪y, y⟫_ℝ) ((2 : ℝ) • x) x := by + rw [← gradient_inner_self x] + exact (differentiableAt_fun_id.inner ℝ differentiableAt_fun_id).hasGradientAt + +/-! + +### C.2. The norm + +-/ + +/-- Away from the origin, the gradient of the norm is the unit vector `‖x‖⁻¹ • x`. -/ +lemma hasGradientAt_norm (hx : x ≠ 0) : HasGradientAt (fun y : F => ‖y‖) (‖x‖⁻¹ • x) x := by + have hs : ⟪x, x⟫_ℝ ≠ 0 := by simpa using hx + have h := (Real.hasDerivAt_sqrt hs).comp_hasGradientAt (hasGradientAt_inner_self x) + simp only [← norm_eq_sqrt_real_inner] at h + convert h using 1 + rw [smul_smul] + congr 1 + field_simp + +/-! + +### C.3. Coordinate functionals on Euclidean space + +-/ + +/-- The gradient of the `i`-th coordinate functional on Euclidean space is the `i`-th basis +vector. -/ +lemma hasGradientAt_coord {ι : Type*} [Fintype ι] [DecidableEq ι] (i : ι) + (x : EuclideanSpace ℝ ι) : + HasGradientAt (fun y : EuclideanSpace ℝ ι => y i) (EuclideanSpace.single i 1) x := by + rw [← gradient_coord i x] + exact (EuclideanSpace.proj (𝕜 := ℝ) i).differentiableAt.hasGradientAt From 4e03862404478bf090cd18b5d09ba0bae487ddf6 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Tue, 29 Sep 2026 21:47:59 +0100 Subject: [PATCH 04/11] feat(PhyslibAlpha): central forces - `CentralForce`, a particle in three dimensions under a central potential smooth away from the centre, with its `hamiltonian`. - `CentralForce.hasGradientAt_hamiltonian_momentum` and `CentralForce.hasGradientAt_hamiltonian_position`, the partial gradients of the Hamiltonian: the velocity `p / m`, and away from the centre a multiple of the position. - `CentralForce.contDiffOn_hamiltonian`, the Hamiltonian is smooth away from the centre of force. Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 1 + .../CentralForce/Basic.lean | 140 ++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 PhyslibAlpha/ClassicalMechanics/CentralForce/Basic.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index 3a56567893..2a9c0ed9a5 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -21,6 +21,7 @@ public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergence public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergenceEquivalence public import PhyslibAlpha.ClassicalFieldTheory.Local.Variation public import PhyslibAlpha.ClassicalMechanics.CoupledSpringPotential +public import PhyslibAlpha.ClassicalMechanics.CentralForce.Basic public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Cohomology diff --git a/PhyslibAlpha/ClassicalMechanics/CentralForce/Basic.lean b/PhyslibAlpha/ClassicalMechanics/CentralForce/Basic.lean new file mode 100644 index 0000000000..2b8b0e6e17 --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/CentralForce/Basic.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import PhyslibAlpha.Mathematics.HasGradient +public import Mathlib.Analysis.InnerProductSpace.PiL2 +/-! + +# Central forces + +## i. Overview + +A particle of mass `m` in three-dimensional space moving under a *central force* is pushed along +the line joining it to a fixed centre, by a force derived from a potential `V (‖q‖)` which depends +only on the distance `‖q‖` from the centre. Its Hamiltonian, as a function of the momentum `p` and +the position `q`, is + +$$H(p, q) = \frac{\langle p, p\rangle}{2m} + V(\|q\|).$$ + +The Kepler problem, `V r = -k / r`, and the isotropic harmonic oscillator, `V r = k r² / 2`, are +the most important examples. + +This file defines the Hamiltonian and computes its partial gradients: the momentum gradient is the +velocity `p / m`, and away from the centre the position gradient `V'(‖q‖) q / ‖q‖` is parallel to +the position. The latter is what makes the angular momentum a conserved quantity. + +## ii. Key results + +- `CentralForce` : the input data, a mass and a potential smooth away from the centre of force. +- `CentralForce.hamiltonian` : the Hamiltonian. +- `CentralForce.hasGradientAt_hamiltonian_momentum`, + `CentralForce.hasGradientAt_hamiltonian_position` : its partial gradients. +- `CentralForce.contDiffOn_hamiltonian` : it is smooth away from the centre of force. + +## iii. Table of contents + +- A. The input data +- B. The Hamiltonian + - B.1. Gradients of the Hamiltonian + - B.2. Smoothness of the Hamiltonian + +## iv. References + +* H. Goldstein, C. Poole and J. Safko, *Classical Mechanics*, 3rd edition, Chapter 3. +-/ + +@[expose] public section + +namespace ClassicalMechanics + +open InnerProductSpace +open scoped ContDiff + +/-! + +## A. The input data + +-/ + +/-- A particle in three-dimensional space under a central force, specified by its mass `m` and a +potential `V`, a function of the distance from the centre of force which is smooth away from the +centre. -/ +structure CentralForce where + /-- The mass of the particle. -/ + m : ℝ + /-- The potential, as a function of the distance from the centre of force. -/ + V : ℝ → ℝ + /-- The mass of the particle is positive. -/ + m_pos : 0 < m + /-- The potential is smooth away from the centre of force. -/ + contDiffOn_V : ContDiffOn ℝ ∞ V (Set.Ioi 0) + +namespace CentralForce + +variable (S : CentralForce) + +/-- The mass of the particle is non-zero. -/ +lemma m_ne_zero : S.m ≠ 0 := S.m_pos.ne' + +/-! + +## B. The Hamiltonian + +-/ + +/-- The Hamiltonian `H(p, q) = ⟪p, p⟫ / (2 m) + V ‖q‖` of a central-force system, as a function of +the momentum `p` and the position `q`. -/ +noncomputable def hamiltonian (p q : EuclideanSpace ℝ (Fin 3)) : ℝ := + (1 / (2 * S.m)) * ⟪p, p⟫_ℝ + S.V ‖q‖ + +/-! + +### B.1. Gradients of the Hamiltonian + +-/ + +/-- The momentum gradient of the Hamiltonian of a central-force system is the velocity `p / m`. -/ +lemma hasGradientAt_hamiltonian_momentum (p q : EuclideanSpace ℝ (Fin 3)) : + HasGradientAt (fun p' => S.hamiltonian p' q) (S.m⁻¹ • p) p := by + show HasGradientAt (fun p' => (1 / (2 * S.m)) * ⟪p', p'⟫_ℝ + S.V ‖q‖) _ p + convert ((hasGradientAt_inner_self p).const_mul (1 / (2 * S.m))).add + (hasGradientAt_const p (S.V ‖q‖)) using 1 + module + +/-- Away from the centre of force, the position gradient of the Hamiltonian of a central-force +system is `V'(‖q‖) q / ‖q‖`, which is parallel to the position. -/ +lemma hasGradientAt_hamiltonian_position (p : EuclideanSpace ℝ (Fin 3)) + {q : EuclideanSpace ℝ (Fin 3)} (hq : q ≠ 0) : + HasGradientAt (fun q' => S.hamiltonian p q') ((deriv S.V ‖q‖ / ‖q‖) • q) q := by + have hV : HasDerivAt S.V (deriv S.V ‖q‖) ‖q‖ := + ((S.contDiffOn_V.differentiableOn (by simp)).differentiableAt + (Ioi_mem_nhds (norm_pos_iff.mpr hq))).hasDerivAt + show HasGradientAt (fun q' => (1 / (2 * S.m)) * ⟪p, p⟫_ℝ + S.V ‖q'‖) _ q + convert (hasGradientAt_const q ((1 / (2 * S.m)) * ⟪p, p⟫_ℝ)).add + (hV.comp_hasGradientAt (hasGradientAt_norm hq)) using 1 + rw [zero_add, smul_smul, div_eq_mul_inv] + +/-! + +### B.2. Smoothness of the Hamiltonian + +-/ + +/-- The Hamiltonian of a central-force system is smooth away from the centre of force. -/ +lemma contDiffOn_hamiltonian : + ContDiffOn ℝ ∞ (Function.uncurry S.hamiltonian) {x | x.2 ≠ 0} := by + have hnorm : ContDiffOn ℝ ∞ + (fun x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3) => ‖x.2‖) {x | x.2 ≠ 0} := + fun x hx => ((contDiffAt_norm ℝ hx).comp x contDiffAt_snd).contDiffWithinAt + have hkin : ContDiff ℝ ∞ (fun x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3) => + (1 / (2 * S.m)) * ⟪x.1, x.1⟫_ℝ) := + contDiff_const.mul (contDiff_fst.inner ℝ contDiff_fst) + exact hkin.contDiffOn.add (S.contDiffOn_V.comp hnorm fun x hx => norm_pos_iff.mpr hx) + +end CentralForce + +end ClassicalMechanics From b07c1bba16b81d1875b3df6ad7154c045022b2b1 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Tue, 29 Sep 2026 21:47:59 +0100 Subject: [PATCH 05/11] feat(PhyslibAlpha): angular momentum is conserved under a central force MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `CentralForce.angularMomentum`, the angular momentum `q × p`, with `angularMomentumSq` and `angularMomentumZ`, Lagrange's identity `angularMomentumSq_eq`, their gradients and smoothness. - `poissonBracket_angularMomentumSq_angularMomentumZ`, `{L², L_z} = 0`, and `poissonBracket_angularMomentumSq_hamiltonian`, `poissonBracket_angularMomentumZ_hamiltonian`, both are conserved under a central force (via the `_eq_zero_of_hasGradientAt` versions for any Hamiltonian with gradients parallel to `p` and `q`). Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 1 + .../CentralForce/AngularMomentum.lean | 271 ++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 PhyslibAlpha/ClassicalMechanics/CentralForce/AngularMomentum.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index 2a9c0ed9a5..5f1b6f8b62 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -21,6 +21,7 @@ public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergence public import PhyslibAlpha.ClassicalFieldTheory.Local.TotalDivergenceEquivalence public import PhyslibAlpha.ClassicalFieldTheory.Local.Variation public import PhyslibAlpha.ClassicalMechanics.CoupledSpringPotential +public import PhyslibAlpha.ClassicalMechanics.CentralForce.AngularMomentum public import PhyslibAlpha.ClassicalMechanics.CentralForce.Basic public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Basic diff --git a/PhyslibAlpha/ClassicalMechanics/CentralForce/AngularMomentum.lean b/PhyslibAlpha/ClassicalMechanics/CentralForce/AngularMomentum.lean new file mode 100644 index 0000000000..7197a2c844 --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/CentralForce/AngularMomentum.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import PhyslibAlpha.ClassicalMechanics.CentralForce.Basic +public import PhyslibAlpha.ClassicalMechanics.PoissonBracket.Basic +public import Mathlib.LinearAlgebra.CrossProduct +/-! + +# Angular momentum and its conservation under a central force + +## i. Overview + +The angular momentum of a particle at position `q` with momentum `p` is `L = q × p`. This file +defines it on phase space, together with the two functions of it which Poisson-commute: its squared +magnitude `L² = ‖L‖²` and its component `L_z` along the z-axis. Their gradients follow from +Lagrange's identity `‖q × p‖² = ⟪q, q⟫ ⟪p, p⟫ - ⟪q, p⟫²` and the explicit form +`L_z = q₀ p₁ - q₁ p₀`. + +We show that `L²` and `L_z` are in involution, and that both Poisson-commute with any Hamiltonian +whose momentum gradient is parallel to the momentum and whose position gradient is parallel to the +position. By `CentralForce.hasGradientAt_hamiltonian_momentum` and +`CentralForce.hasGradientAt_hamiltonian_position`, this includes the Hamiltonian of every +central-force system away from the centre of force, so `L²` and `L_z` are conserved by the motion. + +## ii. Key results + +- `CentralForce.angularMomentum` : the angular momentum `L = q × p`. +- `CentralForce.angularMomentumSq`, `CentralForce.angularMomentumZ` : `L²` and `L_z`. +- `CentralForce.angularMomentumSq_eq` : Lagrange's identity for `L²`. +- `CentralForce.poissonBracket_angularMomentumSq_angularMomentumZ` : `{L², L_z} = 0`. +- `CentralForce.poissonBracket_angularMomentumSq_hamiltonian`, + `CentralForce.poissonBracket_angularMomentumZ_hamiltonian` : `L²` and `L_z` Poisson-commute with + the Hamiltonian of a central-force system. + +## iii. Table of contents + +- A. The angular momentum + - A.1. The squared magnitude and the z-component + - A.2. Smoothness +- B. Gradients +- C. Poisson brackets + - C.1. The squared magnitude and the z-component are in involution + - C.2. Conservation under a rotationally invariant Hamiltonian + - C.3. Conservation under a central force + +## iv. References + +* H. Goldstein, C. Poole and J. Safko, *Classical Mechanics*, 3rd edition, Chapter 9. +-/ + +@[expose] public section + +namespace ClassicalMechanics + +namespace CentralForce + +open InnerProductSpace Matrix +open scoped ContDiff + +/-! + +## A. The angular momentum + +-/ + +/-- The angular momentum `L = q × p` of a particle at position `q` with momentum `p`. -/ +noncomputable def angularMomentum (p q : EuclideanSpace ℝ (Fin 3)) : EuclideanSpace ℝ (Fin 3) := + WithLp.toLp 2 (q.ofLp ⨯₃ p.ofLp) + +/-- The x-component of the angular momentum is `q₁ p₂ - q₂ p₁`. -/ +lemma angularMomentum_apply_zero (p q : EuclideanSpace ℝ (Fin 3)) : + angularMomentum p q 0 = q 1 * p 2 - q 2 * p 1 := by + simp [angularMomentum, cross_apply] + +/-- The y-component of the angular momentum is `q₂ p₀ - q₀ p₂`. -/ +lemma angularMomentum_apply_one (p q : EuclideanSpace ℝ (Fin 3)) : + angularMomentum p q 1 = q 2 * p 0 - q 0 * p 2 := by + simp [angularMomentum, cross_apply] + +/-- The z-component of the angular momentum is `q₀ p₁ - q₁ p₀`. -/ +lemma angularMomentum_apply_two (p q : EuclideanSpace ℝ (Fin 3)) : + angularMomentum p q 2 = q 0 * p 1 - q 1 * p 0 := by + simp [angularMomentum, cross_apply] + +/-! + +### A.1. The squared magnitude and the z-component + +-/ + +/-- The squared magnitude `L² = ‖q × p‖²` of the angular momentum, as a function on phase +space. -/ +noncomputable def angularMomentumSq (p q : EuclideanSpace ℝ (Fin 3)) : ℝ := + ‖angularMomentum p q‖ ^ 2 + +/-- The component `L_z` of the angular momentum along the z-axis, as a function on phase space. -/ +noncomputable def angularMomentumZ (p q : EuclideanSpace ℝ (Fin 3)) : ℝ := + angularMomentum p q 2 + +/-- The squared magnitude of the angular momentum is the sum of the squares of its components. -/ +lemma angularMomentumSq_eq_sum (p q : EuclideanSpace ℝ (Fin 3)) : + angularMomentumSq p q = + angularMomentum p q 0 ^ 2 + angularMomentum p q 1 ^ 2 + angularMomentum p q 2 ^ 2 := by + rw [angularMomentumSq, EuclideanSpace.norm_sq_eq, Fin.sum_univ_three] + simp only [Real.norm_eq_abs, sq_abs] + +/-- Lagrange's identity: the squared magnitude of the angular momentum `q × p` is +`⟪q, q⟫ ⟪p, p⟫ - ⟪q, p⟫²`. -/ +lemma angularMomentumSq_eq (p q : EuclideanSpace ℝ (Fin 3)) : + angularMomentumSq p q = ⟪q, q⟫_ℝ * ⟪p, p⟫_ℝ - ⟪q, p⟫_ℝ ^ 2 := by + rw [angularMomentumSq_eq_sum, angularMomentum_apply_zero, angularMomentum_apply_one, + angularMomentum_apply_two] + simp only [PiLp.inner_apply, Fin.sum_univ_three, RCLike.inner_apply, conj_trivial] + ring + +/-! + +### A.2. Smoothness + +-/ + +/-- The squared magnitude of the angular momentum is a smooth function on phase space. -/ +lemma contDiff_angularMomentumSq : ContDiff ℝ ∞ (Function.uncurry angularMomentumSq) := by + have h : Function.uncurry angularMomentumSq = + fun x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3) => + ⟪x.2, x.2⟫_ℝ * ⟪x.1, x.1⟫_ℝ - ⟪x.2, x.1⟫_ℝ ^ 2 := + funext fun x => angularMomentumSq_eq x.1 x.2 + rw [h] + exact ((contDiff_snd.inner ℝ contDiff_snd).mul (contDiff_fst.inner ℝ contDiff_fst)).sub + ((contDiff_snd.inner ℝ contDiff_fst).pow 2) + +/-- The z-component of the angular momentum is a smooth function on phase space. -/ +lemma contDiff_angularMomentumZ : ContDiff ℝ ∞ (Function.uncurry angularMomentumZ) := by + have h : Function.uncurry angularMomentumZ = + fun x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3) => + x.2 0 * x.1 1 - x.2 1 * x.1 0 := + funext fun x => angularMomentum_apply_two x.1 x.2 + rw [h] + fun_prop + +/-! + +## B. Gradients + +-/ + +/-- The momentum gradient of `L²` is `2 ⟪q, q⟫ p - 2 ⟪q, p⟫ q`. -/ +lemma hasGradientAt_angularMomentumSq_momentum (p q : EuclideanSpace ℝ (Fin 3)) : + HasGradientAt (fun p' => angularMomentumSq p' q) + ((2 * ⟪q, q⟫_ℝ) • p - (2 * ⟪q, p⟫_ℝ) • q) p := by + simp only [angularMomentumSq_eq] + convert ((hasGradientAt_inner_self p).const_mul ⟪q, q⟫_ℝ).sub + ((hasDerivAt_pow 2 _).comp_hasGradientAt (hasGradientAt_inner_left q p)) using 1 + module + +/-- The position gradient of `L²` is `2 ⟪p, p⟫ q - 2 ⟪q, p⟫ p`. -/ +lemma hasGradientAt_angularMomentumSq_position (p q : EuclideanSpace ℝ (Fin 3)) : + HasGradientAt (fun q' => angularMomentumSq p q') + ((2 * ⟪p, p⟫_ℝ) • q - (2 * ⟪q, p⟫_ℝ) • p) q := by + simp only [angularMomentumSq_eq] + convert ((hasGradientAt_inner_self q).mul (hasGradientAt_const q ⟪p, p⟫_ℝ)).sub + ((hasDerivAt_pow 2 _).comp_hasGradientAt (hasGradientAt_inner_right p q)) using 1 + module + +/-- The momentum gradient of `L_z` is `q₀ e₁ - q₁ e₀`. -/ +lemma hasGradientAt_angularMomentumZ_momentum (p q : EuclideanSpace ℝ (Fin 3)) : + HasGradientAt (fun p' => angularMomentumZ p' q) + (q 0 • EuclideanSpace.single 1 1 - q 1 • EuclideanSpace.single 0 1) p := by + simp only [angularMomentumZ, angularMomentum_apply_two] + exact ((hasGradientAt_coord 1 p).const_mul (q 0)).sub + ((hasGradientAt_coord 0 p).const_mul (q 1)) + +/-- The position gradient of `L_z` is `p₁ e₀ - p₀ e₁`. -/ +lemma hasGradientAt_angularMomentumZ_position (p q : EuclideanSpace ℝ (Fin 3)) : + HasGradientAt (fun q' => angularMomentumZ p q') + (p 1 • EuclideanSpace.single 0 1 - p 0 • EuclideanSpace.single 1 1) q := by + simp only [angularMomentumZ, angularMomentum_apply_two] + convert ((hasGradientAt_coord 0 q).mul (hasGradientAt_const q (p 1))).sub + ((hasGradientAt_coord 1 q).mul (hasGradientAt_const q (p 0))) using 1 + module + +/-! + +## C. Poisson brackets + +-/ + +/-! + +### C.1. The squared magnitude and the z-component are in involution + +-/ + +/-- The squared magnitude of the angular momentum and its z-component are in involution. -/ +lemma poissonBracket_angularMomentumSq_angularMomentumZ (p q : EuclideanSpace ℝ (Fin 3)) : + poissonBracket angularMomentumSq angularMomentumZ p q = 0 := by + rw [poissonBracket_eq_of_hasGradientAt (hasGradientAt_angularMomentumSq_momentum p q) + (hasGradientAt_angularMomentumSq_position p q) (hasGradientAt_angularMomentumZ_momentum p q) + (hasGradientAt_angularMomentumZ_position p q)] + simp only [inner_sub_left, inner_sub_right, real_inner_smul_right, + EuclideanSpace.inner_single_right, conj_trivial, PiLp.smul_apply, smul_eq_mul] + ring + +/-! + +### C.2. Conservation under a rotationally invariant Hamiltonian + +A Hamiltonian whose momentum gradient is parallel to the momentum and whose position gradient is +parallel to the position, such as one depending only on `‖p‖` and `‖q‖`, is invariant under +rotations, and so Poisson-commutes with the angular momentum. + +-/ + +/-- `L²` Poisson-commutes with any phase-space function whose momentum gradient is parallel to the +momentum and whose position gradient is parallel to the position. -/ +lemma poissonBracket_angularMomentumSq_eq_zero_of_hasGradientAt + {H : EuclideanSpace ℝ (Fin 3) → EuclideanSpace ℝ (Fin 3) → ℝ} + {p q : EuclideanSpace ℝ (Fin 3)} {a c : ℝ} + (hp : HasGradientAt (fun p' => H p' q) (a • p) p) + (hq : HasGradientAt (fun q' => H p q') (c • q) q) : + poissonBracket angularMomentumSq H p q = 0 := by + rw [poissonBracket_eq_of_hasGradientAt (hasGradientAt_angularMomentumSq_momentum p q) + (hasGradientAt_angularMomentumSq_position p q) hp hq] + simp only [inner_sub_left, real_inner_smul_left, real_inner_smul_right, real_inner_comm p q] + ring + +/-- `L_z` Poisson-commutes with any phase-space function whose momentum gradient is parallel to +the momentum and whose position gradient is parallel to the position. -/ +lemma poissonBracket_angularMomentumZ_eq_zero_of_hasGradientAt + {H : EuclideanSpace ℝ (Fin 3) → EuclideanSpace ℝ (Fin 3) → ℝ} + {p q : EuclideanSpace ℝ (Fin 3)} {a c : ℝ} + (hp : HasGradientAt (fun p' => H p' q) (a • p) p) + (hq : HasGradientAt (fun q' => H p q') (c • q) q) : + poissonBracket angularMomentumZ H p q = 0 := by + rw [poissonBracket_eq_of_hasGradientAt (hasGradientAt_angularMomentumZ_momentum p q) + (hasGradientAt_angularMomentumZ_position p q) hp hq] + simp only [inner_sub_left, real_inner_smul_left, real_inner_smul_right, + EuclideanSpace.inner_single_left, conj_trivial] + ring + +/-! + +### C.3. Conservation under a central force + +-/ + +variable (S : CentralForce) + +/-- Away from the centre of force, the squared magnitude of the angular momentum Poisson-commutes +with the Hamiltonian of a central-force system, so is conserved by the motion. -/ +lemma poissonBracket_angularMomentumSq_hamiltonian (p : EuclideanSpace ℝ (Fin 3)) + {q : EuclideanSpace ℝ (Fin 3)} (hq : q ≠ 0) : + poissonBracket angularMomentumSq S.hamiltonian p q = 0 := + poissonBracket_angularMomentumSq_eq_zero_of_hasGradientAt + (S.hasGradientAt_hamiltonian_momentum p q) (S.hasGradientAt_hamiltonian_position p hq) + +/-- Away from the centre of force, the z-component of the angular momentum Poisson-commutes with +the Hamiltonian of a central-force system, so is conserved by the motion. -/ +lemma poissonBracket_angularMomentumZ_hamiltonian (p : EuclideanSpace ℝ (Fin 3)) + {q : EuclideanSpace ℝ (Fin 3)} (hq : q ≠ 0) : + poissonBracket angularMomentumZ S.hamiltonian p q = 0 := + poissonBracket_angularMomentumZ_eq_zero_of_hasGradientAt + (S.hasGradientAt_hamiltonian_momentum p q) (S.hasGradientAt_hamiltonian_position p hq) + +end CentralForce + +end ClassicalMechanics From 3e9d3b5fe5b498c2d790eae1b02f0265f767a3cb Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 27 Sep 2026 00:07:46 +0100 Subject: [PATCH 06/11] feat(PhyslibAlpha): analytic functions are non-zero on a dense set - `AnalyticOnNhd.dense_setOf_ne_zero`, by the identity principle a function analytic on a connected space and non-zero at some point is non-zero on a dense set. - `analyticAt_euclideanSpace_apply`, coordinate functionals on Euclidean space are analytic, tagged `fun_prop` so that polynomial functions of the coordinates are automatically analytic. Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 1 + .../Mathematics/AnalyticNonvanishing.lean | 72 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 PhyslibAlpha/Mathematics/AnalyticNonvanishing.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index 5f1b6f8b62..afceea7972 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -68,6 +68,7 @@ public import PhyslibAlpha.Mathematics.Order.PositiveDual.RieszKantorovich public import PhyslibAlpha.Mathematics.Order.PositiveDual.UpperEnvelope public import PhyslibAlpha.Mathematics.Order.StrongUnit public import PhyslibAlpha.Mathematics.Order.VectorLattice +public import PhyslibAlpha.Mathematics.AnalyticNonvanishing public import PhyslibAlpha.Mathematics.HasGradient public import PhyslibAlpha.Mathematics.PartialDerivativeTest public import PhyslibAlpha.Mathematics.Probability.Kernel.Factorization diff --git a/PhyslibAlpha/Mathematics/AnalyticNonvanishing.lean b/PhyslibAlpha/Mathematics/AnalyticNonvanishing.lean new file mode 100644 index 0000000000..f53b340956 --- /dev/null +++ b/PhyslibAlpha/Mathematics/AnalyticNonvanishing.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import Mathlib.Analysis.Analytic.Uniqueness +public import Mathlib.Analysis.InnerProductSpace.PiL2 +/-! + +# Analytic functions are non-zero on a dense set + +## i. Overview + +By the identity principle, an analytic function on a connected normed space which vanishes on a +non-empty open set vanishes everywhere. Hence an analytic function which is non-zero at one point +is non-zero on a dense set. + +This is how domains of phase space cut out by the non-vanishing of polynomial functions of the +coordinates are shown to be dense, for instance the domains on which Hamiltonian systems are shown +to be Liouville integrable. To make the analyticity of such polynomial functions automatic, the +coordinate functionals on Euclidean space are shown to be analytic and tagged for `fun_prop`. + +## ii. Key results + +- `AnalyticOnNhd.dense_setOf_ne_zero` : a function analytic on a connected space and non-zero at + some point is non-zero on a dense set. +- `analyticAt_euclideanSpace_apply` : coordinate functionals on Euclidean space are analytic. + +## iii. Table of contents + +- A. Density of the non-vanishing set +- B. Analyticity of coordinate functionals +-/ + +@[expose] public section + +open Filter Topology + +/-! + +## A. Density of the non-vanishing set + +-/ + +/-- A function analytic on a connected space, and non-zero at some point, is non-zero on a dense +set. -/ +lemma AnalyticOnNhd.dense_setOf_ne_zero {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] + [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] + [PreconnectedSpace E] {f : E → F} (hf : AnalyticOnNhd 𝕜 f Set.univ) {x₀ : E} + (hx₀ : f x₀ ≠ 0) : Dense {x | f x ≠ 0} := by + rw [dense_iff_inter_open] + rintro W hW ⟨z, hz⟩ + by_contra h + have hzero : f =ᶠ[𝓝 z] 0 := by + filter_upwards [hW.mem_nhds hz] with y hy + by_contra hne + exact h ⟨y, hy, hne⟩ + exact hx₀ (congrFun (hf.eq_of_eventuallyEq analyticOnNhd_const hzero) x₀) + +/-! + +## B. Analyticity of coordinate functionals + +-/ + +/-- The coordinate functionals on Euclidean space are analytic. -/ +@[fun_prop] +lemma analyticAt_euclideanSpace_apply {𝕜 ι : Type*} [RCLike 𝕜] [Fintype ι] (i : ι) + (z : EuclideanSpace 𝕜 ι) : AnalyticAt 𝕜 (fun x : EuclideanSpace 𝕜 ι => x i) z := + (EuclideanSpace.proj (𝕜 := 𝕜) i).analyticAt z From 2f5fc62828d7c7bdc3963b3130566ba98dad89de Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 27 Sep 2026 00:12:01 +0100 Subject: [PATCH 07/11] feat(PhyslibAlpha): central-force systems are Liouville integrable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `CentralForce.integrabilityDomain`, where the radial momentum is non-zero and the angular momentum is not parallel to the z-axis, with `isOpen_integrabilityDomain` and `dense_integrabilityDomain` (via the non-vanishing of an analytic polynomial). - `CentralForce.conservedQuantities`, the energy, `L²` and `L_z`, with `poissonBracket_conservedQuantities` (involution), `gradient_conservedQuantities`, `linearIndependent_gradients` and `linearIndependent_conservedQuantities` (functional independence). - `CentralForce.liouvilleIntegrable`, every central-force system is Liouville integrable on the domain. Co-Authored-By: Claude Opus 5.5 --- PhyslibAlpha.lean | 1 + .../LiouvilleIntegrable/CentralForce.lean | 265 ++++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index afceea7972..5cdc2c1960 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -24,6 +24,7 @@ public import PhyslibAlpha.ClassicalMechanics.CoupledSpringPotential public import PhyslibAlpha.ClassicalMechanics.CentralForce.AngularMomentum public import PhyslibAlpha.ClassicalMechanics.CentralForce.Basic public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic +public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.CentralForce public import PhyslibAlpha.ClassicalMechanics.MomentMap.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Cohomology public import PhyslibAlpha.ClassicalMechanics.MomentMap.GalileanMass diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean new file mode 100644 index 0000000000..b32a74d0ff --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import PhyslibAlpha.ClassicalMechanics.CentralForce.AngularMomentum +public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic +public import PhyslibAlpha.Mathematics.AnalyticNonvanishing +/-! + +# Central-force systems are Liouville integrable + +## i. Overview + +A particle in three-dimensional space under a central force has three degrees of freedom and three +conserved quantities in involution: the Hamiltonian `H`, the squared magnitude `L²` of the angular +momentum, and its z-component `L_z`. We show that they are functionally independent on the domain +`CentralForce.integrabilityDomain` of phase space where + +- the radial momentum `⟪q, p⟫` is non-zero, and +- the angular momentum is not parallel to the z-axis, `L_x² + L_y² ≠ 0`. + +This domain excludes the centre of force, where `H` is singular, the points where `L²` and `L_z` +are dependent, and the circular orbits, at which the gradient of `H` is a combination of those of +`L²` and `L_z`. It also excludes the turning points of the radial motion on every other orbit, +where the three quantities are still independent, so it is smaller than it needs to be. It is +open, and it is dense because it is cut out by the non-vanishing of a polynomial in the +coordinates which is not identically zero, which is all that Liouville integrability requires. +Hence every central-force system is Liouville integrable. + +Independence is shown by pairing a vanishing linear combination `α ∇H + β ∇L² + γ ∇L_z = 0` of the +phase-space gradients with four tangent vectors. The radial change of momentum `(q, 0)` is seen +only by `H`, and gives `α ⟪q, p⟫ / m = 0`. The infinitesimal rotations about the x- and y-axes are +seen only by `L_z`, and give `γ L_y = 0` and `γ L_x = 0`. The scaling `(p, 0)` of the momentum +then gives `2 β L² = 0`. + +## ii. Key results + +- `CentralForce.integrabilityDomain` : the domain of phase space on which central-force systems + are shown to be Liouville integrable. +- `CentralForce.isOpen_integrabilityDomain`, `CentralForce.dense_integrabilityDomain` : it is open + and dense. +- `CentralForce.conservedQuantities` : the conserved quantities `H`, `L²` and `L_z`. +- `CentralForce.linearIndependent_conservedQuantities` : on the domain, they are functionally + independent. +- `CentralForce.liouvilleIntegrable` : every central-force system is Liouville integrable. + +## iii. Table of contents + +- A. The domain of integrability +- B. The conserved quantities + - B.1. Involution + - B.2. Functional independence +- C. Liouville integrability + +## iv. References + +* V. I. Arnold, *Mathematical Methods of Classical Mechanics*, 2nd edition, Chapter 10. +-/ + +@[expose] public section + +namespace ClassicalMechanics + +namespace CentralForce + +open InnerProductSpace +open scoped ContDiff + +attribute [local fun_prop] analyticAt_fst analyticAt_snd + +/-! + +## A. The domain of integrability + +-/ + +/-- The domain of phase space on which central-force systems are shown to be Liouville integrable: +the points where the radial momentum `⟪q, p⟫` is non-zero and the angular momentum is not parallel +to the z-axis. -/ +def integrabilityDomain : Set (EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3)) := + {x | ⟪x.2, x.1⟫_ℝ ≠ 0 ∧ angularMomentum x.1 x.2 0 ^ 2 + angularMomentum x.1 x.2 1 ^ 2 ≠ 0} + +/-- The domain of integrability is the set where a polynomial in the coordinates of phase space +does not vanish. -/ +lemma integrabilityDomain_eq : integrabilityDomain = + {x | (x.1 0 * x.2 0 + x.1 1 * x.2 1 + x.1 2 * x.2 2) * + ((x.2 1 * x.1 2 - x.2 2 * x.1 1) ^ 2 + (x.2 2 * x.1 0 - x.2 0 * x.1 2) ^ 2) ≠ 0} := by + ext x + simp only [integrabilityDomain, Set.mem_ofPred_eq, mul_ne_zero_iff, angularMomentum_apply_zero, + angularMomentum_apply_one, PiLp.inner_apply, Fin.sum_univ_three, RCLike.inner_apply, + conj_trivial] + +/-- The domain of integrability is open. -/ +lemma isOpen_integrabilityDomain : IsOpen integrabilityDomain := by + rw [integrabilityDomain_eq] + exact isOpen_ne_fun (by fun_prop) continuous_const + +/-- The domain of integrability is dense. -/ +lemma dense_integrabilityDomain : Dense integrabilityDomain := by + rw [integrabilityDomain_eq] + refine AnalyticOnNhd.dense_setOf_ne_zero (𝕜 := ℝ) (fun z _ => by fun_prop) + (x₀ := (!₂[1, 0, 1], !₂[1, 0, 0])) ?_ + norm_num [Matrix.cons_val_two] + +/-- The domain of integrability excludes the centre of force. -/ +lemma snd_ne_zero_of_mem_integrabilityDomain + {x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3)} (hx : x ∈ integrabilityDomain) : + x.2 ≠ 0 := by + intro h + exact hx.1 (by rw [h, inner_zero_left]) + +/-! + +## B. The conserved quantities + +-/ + +variable (S : CentralForce) + +/-- The three conserved quantities in involution of a central-force system: the Hamiltonian `H`, +the squared magnitude `L²` of the angular momentum, and its z-component `L_z`. -/ +noncomputable def conservedQuantities : + Fin 3 → EuclideanSpace ℝ (Fin 3) → EuclideanSpace ℝ (Fin 3) → ℝ := + ![S.hamiltonian, angularMomentumSq, angularMomentumZ] + +/-! + +### B.1. Involution + +-/ + +/-- Away from the centre of force, the conserved quantities of a central-force system are pairwise +in involution. -/ +lemma poissonBracket_conservedQuantities (i j : Fin 3) (p : EuclideanSpace ℝ (Fin 3)) + {q : EuclideanSpace ℝ (Fin 3)} (hq : q ≠ 0) : + poissonBracket (S.conservedQuantities i) (S.conservedQuantities j) p q = 0 := by + have hSqH := S.poissonBracket_angularMomentumSq_hamiltonian p hq + have hZH := S.poissonBracket_angularMomentumZ_hamiltonian p hq + have hSqZ := poissonBracket_angularMomentumSq_angularMomentumZ p q + have hHSq : poissonBracket S.hamiltonian angularMomentumSq p q = 0 := by + rw [poissonBracket_antisymm, hSqH, neg_zero] + have hHZ : poissonBracket S.hamiltonian angularMomentumZ p q = 0 := by + rw [poissonBracket_antisymm, hZH, neg_zero] + have hZSq : poissonBracket angularMomentumZ angularMomentumSq p q = 0 := by + rw [poissonBracket_antisymm, hSqZ, neg_zero] + fin_cases i <;> fin_cases j <;> simp [conservedQuantities, poissonBracket_self, *] + +/-! + +### B.2. Functional independence + +-/ + +/-- Away from the centre of force, the phase-space gradients of the conserved quantities of a +central-force system. -/ +lemma gradient_conservedQuantities (p : EuclideanSpace ℝ (Fin 3)) {q : EuclideanSpace ℝ (Fin 3)} + (hq : q ≠ 0) : + (fun i => (gradient (fun p' => S.conservedQuantities i p' q) p, + gradient (fun q' => S.conservedQuantities i p q') q)) = + ![(S.m⁻¹ • p, (deriv S.V ‖q‖ / ‖q‖) • q), + ((2 * ⟪q, q⟫_ℝ) • p - (2 * ⟪q, p⟫_ℝ) • q, (2 * ⟪p, p⟫_ℝ) • q - (2 * ⟪q, p⟫_ℝ) • p), + (q 0 • EuclideanSpace.single 1 1 - q 1 • EuclideanSpace.single 0 1, + p 1 • EuclideanSpace.single 0 1 - p 0 • EuclideanSpace.single 1 1)] := by + funext i + fin_cases i + · exact Prod.ext (S.hasGradientAt_hamiltonian_momentum p q).gradient + (S.hasGradientAt_hamiltonian_position p hq).gradient + · exact Prod.ext (hasGradientAt_angularMomentumSq_momentum p q).gradient + (hasGradientAt_angularMomentumSq_position p q).gradient + · exact Prod.ext (hasGradientAt_angularMomentumZ_momentum p q).gradient + (hasGradientAt_angularMomentumZ_position p q).gradient + +/-- On the domain of integrability, a phase-space function whose momentum gradient is a non-zero +multiple `a • p` of the momentum and whose position gradient is a multiple `c • q` of the +position, such as the Hamiltonian of a central-force system, is functionally independent of `L²` +and `L_z`: the three phase-space gradients are linearly independent. -/ +lemma linearIndependent_gradients {p q : EuclideanSpace ℝ (Fin 3)} {a c : ℝ} (ha : a ≠ 0) + (hx : (p, q) ∈ integrabilityDomain) : + LinearIndependent ℝ ![(a • p, c • q), + ((2 * ⟪q, q⟫_ℝ) • p - (2 * ⟪q, p⟫_ℝ) • q, (2 * ⟪p, p⟫_ℝ) • q - (2 * ⟪q, p⟫_ℝ) • p), + (q 0 • EuclideanSpace.single 1 1 - q 1 • EuclideanSpace.single 0 1, + p 1 • EuclideanSpace.single 0 1 - p 0 • EuclideanSpace.single 1 1)] := by + rw [integrabilityDomain_eq] at hx + obtain ⟨hqp, hL⟩ := mul_ne_zero_iff.mp hx + rw [Fintype.linearIndependent_iff] + intro g hg + obtain ⟨h1, h2⟩ := Prod.ext_iff.mp hg + simp only [Fin.sum_univ_three, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, + Matrix.head_cons, Matrix.tail_cons, Prod.fst_add, Prod.snd_add, Prod.smul_fst, Prod.smul_snd, + Prod.fst_zero, Prod.snd_zero] at h1 h2 + -- The six components of the vanishing combination of gradients. + have A0 := congrArg (fun v => v 0) h1 + have A1 := congrArg (fun v => v 1) h1 + have A2 := congrArg (fun v => v 2) h1 + have B0 := congrArg (fun v => v 0) h2 + have B1 := congrArg (fun v => v 1) h2 + have B2 := congrArg (fun v => v 2) h2 + have h20 : (2 : Fin 3) ≠ 0 := by decide + have h21 : (2 : Fin 3) ≠ 1 := by decide + simp only [Fin.isValue, PiLp.add_apply, PiLp.smul_apply, smul_eq_mul, PiLp.sub_apply, ne_eq, + zero_ne_one, one_ne_zero, h20, h21, not_false_eq_true, PiLp.single_eq_of_ne, + PiLp.single_eq_same, mul_zero, mul_one, sub_zero, zero_sub, PiLp.zero_apply, PiLp.inner_apply, + Fin.sum_univ_three, RCLike.inner_apply, conj_trivial] at A0 A1 A2 B0 B1 B2 + -- Pairing with the radial change of momentum `(q, 0)`. + have hg0 : g 0 = 0 := by + have h : g 0 * (a * (p 0 * q 0 + p 1 * q 1 + p 2 * q 2)) = 0 := by + linear_combination q 0 * A0 + q 1 * A1 + q 2 * A2 + simpa [ha, hqp] using h + -- Pairing with the infinitesimal rotations about the x- and y-axes. + have hg2 : g 2 = 0 := by + have h : g 2 * ((q 1 * p 2 - q 2 * p 1) ^ 2 + (q 2 * p 0 - q 0 * p 2) ^ 2) = 0 := by + linear_combination (q 1 * p 2 - q 2 * p 1) * (-(p 2 * A0 - p 0 * A2 + q 2 * B0 - q 0 * B2)) + + (q 2 * p 0 - q 0 * p 2) * (-p 2 * A1 + p 1 * A2 - q 2 * B1 + q 1 * B2) + exact (mul_eq_zero.mp h).resolve_right hL + -- Pairing with the scaling `(p, 0)` of the momentum. + have hg1 : g 1 = 0 := by + have h : g 1 * (2 * ((q 1 * p 2 - q 2 * p 1) ^ 2 + (q 2 * p 0 - q 0 * p 2) ^ 2 + + (q 0 * p 1 - q 1 * p 0) ^ 2)) = 0 := by + linear_combination p 0 * A0 + p 1 * A1 + p 2 * A2 - + a * (p 0 ^ 2 + p 1 ^ 2 + p 2 ^ 2) * hg0 - (q 0 * p 1 - q 1 * p 0) * hg2 + refine (mul_eq_zero.mp h).resolve_right (mul_ne_zero two_ne_zero (ne_of_gt ?_)) + exact add_pos_of_pos_of_nonneg (lt_of_le_of_ne (by positivity) (Ne.symm hL)) (sq_nonneg _) + intro i + fin_cases i + exacts [hg0, hg1, hg2] + +/-- On the domain of integrability, the conserved quantities of a central-force system are +functionally independent: their phase-space gradients are linearly independent. -/ +lemma linearIndependent_conservedQuantities + {x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3)} (hx : x ∈ integrabilityDomain) : + LinearIndependent ℝ (fun i => (gradient (fun p' => S.conservedQuantities i p' x.2) x.1, + gradient (fun q' => S.conservedQuantities i x.1 q') x.2)) := by + rw [S.gradient_conservedQuantities x.1 (snd_ne_zero_of_mem_integrabilityDomain hx)] + exact linearIndependent_gradients (inv_ne_zero S.m_ne_zero) hx + +/-! + +## C. Liouville integrability + +-/ + +/-- Every central-force system is Liouville integrable on the domain of integrability, with the +Hamiltonian, the squared magnitude of the angular momentum and its z-component as conserved +quantities. -/ +noncomputable def liouvilleIntegrable : + LiouvilleIntegrableOn integrabilityDomain S.hamiltonian where + isOpen := isOpen_integrabilityDomain + dense := dense_integrabilityDomain + f := S.conservedQuantities + contDiffOn i := by + fin_cases i + · exact S.contDiffOn_hamiltonian.mono fun _ hx => snd_ne_zero_of_mem_integrabilityDomain hx + · exact contDiff_angularMomentumSq.contDiffOn + · exact contDiff_angularMomentumZ.contDiffOn + exists_hamiltonian := ⟨0, rfl⟩ + involutive i j x hx := + S.poissonBracket_conservedQuantities i j x.1 (snd_ne_zero_of_mem_integrabilityDomain hx) + independent _ hx := S.linearIndependent_conservedQuantities hx + +end CentralForce + +end ClassicalMechanics From a7182604cac7b921379f028d547ee330bd9e143a Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Mon, 26 Oct 2026 21:56:05 +0000 Subject: [PATCH 08/11] Add analytic nonvanishing and an open dense central-force domain Apply the analytic identity principle to the polynomial defining a central-force phase-space domain. Keep independence and the Liouville construction for a separate contribution. Co-authored-by: Claude Opus 4.8 --- Physlib.lean | 1 + Physlib/Mathematics/ForMathlib/Analytic.lean | 80 +++++++++++++++++ PhyslibAlpha.lean | 1 + .../LiouvilleIntegrable/CentralForce.lean | 89 +++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 Physlib/Mathematics/ForMathlib/Analytic.lean create mode 100644 PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean diff --git a/Physlib.lean b/Physlib.lean index a4ab2570e6..2a39076255 100644 --- a/Physlib.lean +++ b/Physlib.lean @@ -141,6 +141,7 @@ public import Physlib.Mathematics.Calculus.Wirtinger.Coordinate public import Physlib.Mathematics.Calculus.Wirtinger.Hessian public import Physlib.Mathematics.Distribution.PowMul public import Physlib.Mathematics.Distribution.TemperedDistribution +public import Physlib.Mathematics.ForMathlib.Analytic public import Physlib.Mathematics.ForMathlib.ComplexLinear public import Physlib.Mathematics.ForMathlib.DataStructures.Matrix.LieTrace public import Physlib.Mathematics.ForMathlib.FDerivCurry diff --git a/Physlib/Mathematics/ForMathlib/Analytic.lean b/Physlib/Mathematics/ForMathlib/Analytic.lean new file mode 100644 index 0000000000..de1f429b87 --- /dev/null +++ b/Physlib/Mathematics/ForMathlib/Analytic.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +-- `Uniqueness` imports this module privately; the auxiliary analyticity lemmas need its public API. +public import Mathlib.Analysis.Analytic.Constructions +public import Mathlib.Analysis.Analytic.Uniqueness +public import Mathlib.Analysis.InnerProductSpace.PiL2 +/-! + +# Analyticity and dense non-vanishing sets + +Analytic coordinate functions and density of the non-vanishing set of an analytic function. + +## i. Overview + +By the identity principle, an analytic function on a connected normed space which vanishes on a +non-empty open set vanishes everywhere. Hence an analytic function which is non-zero at one point +is non-zero on a dense set. + +The coordinate functionals on Euclidean space are registered with `fun_prop` to automate proofs of +analyticity for polynomial expressions in the coordinates. Combined with the density lemma, this +shows that the non-vanishing set of such an expression is dense whenever it is non-zero at some +point. Applications include domains in phase space used in proofs of Liouville integrability. + +## ii. Key results + +- `AnalyticOnNhd.dense_setOf_ne_zero` : a function analytic on a connected space and non-zero at + some point is non-zero on a dense set. +- `analyticAt_euclideanSpace_apply` : coordinate functionals on Euclidean space are analytic. + +## iii. Table of contents + +- A. Density of the non-vanishing set +- B. Analyticity of coordinate functionals + +## iv. References + +The density proof uses the identity principle in `Mathlib.Analysis.Analytic.Uniqueness`. +-/ + +@[expose] public section + +open Filter Topology + +/-! + +## A. Density of the non-vanishing set + +-/ + +/-- A function analytic on a connected space, and non-zero at some point, is non-zero on a dense +set. -/ +lemma AnalyticOnNhd.dense_setOf_ne_zero {𝕜 E F : Type*} [NontriviallyNormedField 𝕜] + [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F] [NormedSpace 𝕜 F] + [PreconnectedSpace E] {f : E → F} (hf : AnalyticOnNhd 𝕜 f Set.univ) {x₀ : E} + (hx₀ : f x₀ ≠ 0) : Dense {x | f x ≠ 0} := by + rw [dense_iff_inter_open] + rintro W hW ⟨z, hz⟩ + by_contra h + have hzero : f =ᶠ[𝓝 z] 0 := by + filter_upwards [hW.mem_nhds hz] with y hy + by_contra hne + exact h ⟨y, hy, hne⟩ + exact hx₀ (congrFun (hf.eq_of_eventuallyEq analyticOnNhd_const hzero) x₀) + +/-! + +## B. Analyticity of coordinate functionals + +-/ + +/-- The coordinate functionals on Euclidean space are analytic. -/ +@[fun_prop] +lemma analyticAt_euclideanSpace_apply {𝕜 ι : Type*} [RCLike 𝕜] [Fintype ι] (i : ι) + (z : EuclideanSpace 𝕜 ι) : AnalyticAt 𝕜 (fun x : EuclideanSpace 𝕜 ι => x i) z := + (EuclideanSpace.proj (𝕜 := 𝕜) i).analyticAt z diff --git a/PhyslibAlpha.lean b/PhyslibAlpha.lean index 4b313fa454..9b1fb0511d 100644 --- a/PhyslibAlpha.lean +++ b/PhyslibAlpha.lean @@ -101,6 +101,7 @@ public import PhyslibAlpha.ClassicalMechanics.CentralForce.AngularMomentum public import PhyslibAlpha.ClassicalMechanics.CentralForce.Basic public import PhyslibAlpha.ClassicalMechanics.CoupledSpringPotential public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic +public import PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.CentralForce public import PhyslibAlpha.ClassicalMechanics.MomentMap.Basic public import PhyslibAlpha.ClassicalMechanics.MomentMap.Cohomology public import PhyslibAlpha.ClassicalMechanics.MomentMap.GalileanMass diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean new file mode 100644 index 0000000000..3df7304bd8 --- /dev/null +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 Rithwik Ranganathan. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Rithwik Ranganathan +-/ +module + +public import Physlib.Mathematics.ForMathlib.Analytic +public import PhyslibAlpha.ClassicalMechanics.CentralForce.AngularMomentum +/-! + +# An open dense domain for central-force integrability + +An application of analytic non-vanishing to a domain in central-force phase space. + +## i. Overview + +We consider phase-space points with non-zero radial momentum and angular momentum not parallel +to the z-axis. These conditions define an open dense domain away from the centre of force, +used in the subsequent proof of independence of the observables `H`, `L²` and `L_z`. +Density follows by expressing the domain as the non-vanishing set of a polynomial that is +non-zero at an explicit point. No independence or integrability result is asserted here. + +## ii. Key results + +- `CentralForce.integrabilityDomain` : the chosen domain in phase space. +- `CentralForce.isOpen_integrabilityDomain`, `CentralForce.dense_integrabilityDomain` : it is + open and dense. +- `CentralForce.snd_ne_zero_of_mem_integrabilityDomain` : it excludes the centre of force. + +## iii. Table of contents + +- A. The domain of integrability + +## iv. References + +The density argument uses the analytic identity principle in +`Mathlib.Analysis.Analytic.Uniqueness`. For the integrability framework, see +`PhyslibAlpha.ClassicalMechanics.LiouvilleIntegrable.Basic`. +-/ + +@[expose] public section + +namespace ClassicalMechanics.CentralForce + +open InnerProductSpace + +attribute [local fun_prop] analyticAt_fst analyticAt_snd + +/-! + +## A. The domain of integrability + +-/ + +/-- The phase-space domain where the radial momentum is non-zero and the angular momentum +is not parallel to the z-axis, used to establish central-force integrability. -/ +def integrabilityDomain : Set (EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3)) := + {x | ⟪x.2, x.1⟫_ℝ ≠ 0 ∧ angularMomentum x.1 x.2 0 ^ 2 + angularMomentum x.1 x.2 1 ^ 2 ≠ 0} + +/-- The domain is the non-vanishing set of a polynomial in the phase-space coordinates. -/ +lemma integrabilityDomain_eq : integrabilityDomain = + {x | (x.1 0 * x.2 0 + x.1 1 * x.2 1 + x.1 2 * x.2 2) * + ((x.2 1 * x.1 2 - x.2 2 * x.1 1) ^ 2 + (x.2 2 * x.1 0 - x.2 0 * x.1 2) ^ 2) ≠ 0} := by + ext x + simp only [integrabilityDomain, Set.mem_ofPred_eq, mul_ne_zero_iff, angularMomentum_apply_zero, + angularMomentum_apply_one, PiLp.inner_apply, Fin.sum_univ_three, RCLike.inner_apply, + conj_trivial] + +/-- The chosen central-force domain is open. -/ +lemma isOpen_integrabilityDomain : IsOpen integrabilityDomain := by + rw [integrabilityDomain_eq] + exact isOpen_ne_fun (by fun_prop) continuous_const + +/-- The chosen central-force domain is dense. -/ +lemma dense_integrabilityDomain : Dense integrabilityDomain := by + rw [integrabilityDomain_eq] + refine AnalyticOnNhd.dense_setOf_ne_zero (𝕜 := ℝ) (fun z _ => by fun_prop) + (x₀ := (!₂[1, 0, 1], !₂[1, 0, 0])) ?_ + norm_num [Matrix.cons_val_two] + +/-- The chosen domain excludes the centre of force. -/ +lemma snd_ne_zero_of_mem_integrabilityDomain + {x : EuclideanSpace ℝ (Fin 3) × EuclideanSpace ℝ (Fin 3)} (hx : x ∈ integrabilityDomain) : + x.2 ≠ 0 := by + intro h + exact hx.1 (by rw [h, inner_zero_left]) + +end ClassicalMechanics.CentralForce From ddab82d45b6fb4bd6e2d5131d95bd166287e4563 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 15 Nov 2026 10:27:41 +0000 Subject: [PATCH 09/11] Connect central-force integrability to Hamiltonian systems Co-authored-by: Claude Opus 4.8 --- .../LiouvilleIntegrable/Basic.lean | 20 ++++++++++++++++++- .../LiouvilleIntegrable/CentralForce.lean | 12 +++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean index 21c8211a65..d85bc2613f 100644 --- a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean @@ -5,6 +5,7 @@ Authors: Rithwik Ranganathan -/ module +public import Physlib.ClassicalMechanics.HamiltonianMechanics.Basic public import Physlib.ClassicalMechanics.HamiltonianMechanics.PoissonBracket /-! @@ -49,6 +50,8 @@ already used for e.g. `RigidBody (d : ℕ)`. - `LiouvilleIntegrableOn` : the structure of a Liouville integrable system for a Hamiltonian `H` on an open dense domain `U` of phase space. +- `HamiltonianSystem.IsLiouvilleIntegrableOn` : coordinate integrability for a Hamiltonian system, + including agreement with an autonomous Hamiltonian on the integrability domain. - `LiouvilleIntegrableOn.deriv_comp_eq_zero` : each conserved quantity has zero time derivative along a solution of Hamilton's equations for `H` which stays in `U`. - `LiouvilleIntegrableOn.oneDegreeOfFreedom` : a system with one degree of freedom is Liouville @@ -57,6 +60,7 @@ already used for e.g. `RigidBody (d : ℕ)`. ## iii. Table of contents - A. The definition of Liouville integrability +- A.1. Integrability of Hamiltonian systems - B. Conservation along the flow - C. Systems with one degree of freedom @@ -70,7 +74,7 @@ already used for e.g. `RigidBody (d : ℕ)`. namespace ClassicalMechanics open Time -open scoped ContDiff +open scoped ContDiff Manifold TODO "Formalize the conclusion of the Liouville–Arnold theorem (action-angle coordinates, invariant tori) — the definition here is only its hypothesis." @@ -106,6 +110,20 @@ structure LiouvilleIntegrableOn {d : ℕ} independent : ∀ x ∈ U, LinearIndependent ℝ (fun i => (gradient (fun p' => f i p' x.2) x.1, gradient (fun q' => f i x.1 q') x.2)) +/-! +### A.1. Integrability of Hamiltonian systems +-/ + +/-- A Hamiltonian system is Liouville integrable on a coordinate domain when that domain lies +inside the system's domain and, for every time, the system agrees there with an autonomous +coordinate Hamiltonian satisfying the Liouville integrability conditions. -/ +def HamiltonianSystem.IsLiouvilleIntegrableOn {d : ℕ} + (S : HamiltonianSystem 𝓘(ℝ, EuclideanSpace ℝ (Fin d)) ⟨EuclideanSpace ℝ (Fin d)⟩) + (U : Set (EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d))) : Prop := + ∃ H, Nonempty (LiouvilleIntegrableOn U H) ∧ + (∀ p q, (p, q) ∈ U → PhaseSpace.ofInnerProductSpace p q ∈ S.domain) ∧ + ∀ t p q, (p, q) ∈ U → S.hamiltonian (t, PhaseSpace.ofInnerProductSpace p q) = H p q + /-! ## B. Conservation along the flow diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean index c308ec7724..b6dba63b2a 100644 --- a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean @@ -32,6 +32,8 @@ momentum, infinitesimal rotations and momentum scaling, successively eliminating - `CentralForce.snd_ne_zero_of_mem_integrabilityDomain` : it excludes the centre of force. - `CentralForce.linearIndependent_conservedQuantities` : the observables are independent there. - `CentralForce.liouvilleIntegrable` : the resulting Liouville-integrability construction. +- `CentralForce.toHamiltonianSystem_isLiouvilleIntegrableOn` : the shared Hamiltonian system is + integrable on the same coordinate domain. ## iii. Table of contents @@ -242,4 +244,14 @@ noncomputable def liouvilleIntegrable : S.poissonBracket_conservedQuantities i j x.1 (snd_ne_zero_of_mem_integrabilityDomain hx) independent _ hx := S.linearIndependent_conservedQuantities hx +/-- The Hamiltonian system associated with a central force is Liouville integrable on the +coordinate domain of integrability. -/ +lemma toHamiltonianSystem_isLiouvilleIntegrableOn : + S.toHamiltonianSystem.IsLiouvilleIntegrableOn integrabilityDomain := by + refine ⟨S.hamiltonian, ⟨S.liouvilleIntegrable⟩, ?_, ?_⟩ + · intro p q hpq + exact (S.mem_domain_toHamiltonianSystem p q).2 (snd_ne_zero_of_mem_integrabilityDomain hpq) + · intro t p q _ + exact S.toHamiltonianSystem_hamiltonian t p q + end ClassicalMechanics.CentralForce From be47ee4d7e9926ae211cbbb4ab21d94ad2f2f0ef Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 15 Nov 2026 10:48:15 +0000 Subject: [PATCH 10/11] Fix Liouville integrability module contents indentation Co-authored-by: Claude Opus 4.8 --- PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean index d85bc2613f..56028ce007 100644 --- a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean @@ -60,7 +60,7 @@ already used for e.g. `RigidBody (d : ℕ)`. ## iii. Table of contents - A. The definition of Liouville integrability -- A.1. Integrability of Hamiltonian systems + - A.1. Integrability of Hamiltonian systems - B. Conservation along the flow - C. Systems with one degree of freedom From 2d6617e5e01bf00bd2d6ba1d8496ac50618c3b43 Mon Sep 17 00:00:00 2001 From: Sudo-RR Date: Sun, 15 Nov 2026 11:14:24 +0000 Subject: [PATCH 11/11] Name Hamiltonian system integrability data fields Co-authored-by: Claude Opus 4.8 --- .../LiouvilleIntegrable/Basic.lean | 21 ++++++++++++++++--- .../LiouvilleIntegrable/CentralForce.lean | 10 ++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean index 56028ce007..32c4f0cb3f 100644 --- a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/Basic.lean @@ -50,6 +50,8 @@ already used for e.g. `RigidBody (d : ℕ)`. - `LiouvilleIntegrableOn` : the structure of a Liouville integrable system for a Hamiltonian `H` on an open dense domain `U` of phase space. +- `HamiltonianSystem.LiouvilleIntegrabilityData` : an autonomous coordinate Hamiltonian and its + integrability data, related to a Hamiltonian system on a coordinate domain. - `HamiltonianSystem.IsLiouvilleIntegrableOn` : coordinate integrability for a Hamiltonian system, including agreement with an autonomous Hamiltonian on the integrability domain. - `LiouvilleIntegrableOn.deriv_comp_eq_zero` : each conserved quantity has zero time derivative @@ -114,15 +116,28 @@ structure LiouvilleIntegrableOn {d : ℕ} ### A.1. Integrability of Hamiltonian systems -/ +/-- An autonomous coordinate Hamiltonian and its Liouville integrability data, related to a +Hamiltonian system on a coordinate domain. -/ +structure HamiltonianSystem.LiouvilleIntegrabilityData {d : ℕ} + (S : HamiltonianSystem 𝓘(ℝ, EuclideanSpace ℝ (Fin d)) ⟨EuclideanSpace ℝ (Fin d)⟩) + (U : Set (EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d))) where + /-- The autonomous Hamiltonian in momentum-position coordinates. -/ + coordinateHamiltonian : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d) → ℝ + /-- The system agrees with the coordinate Hamiltonian on the domain at every time. -/ + hamiltonian_eq : ∀ t p q, (p, q) ∈ U → + S.hamiltonian (t, PhaseSpace.ofInnerProductSpace p q) = coordinateHamiltonian p q + /-- Coordinate states in the integrability domain belong to the system's domain. -/ + domain_subset : ∀ p q, (p, q) ∈ U → PhaseSpace.ofInnerProductSpace p q ∈ S.domain + /-- The coordinate Hamiltonian has the Liouville integrability data. -/ + integrable : LiouvilleIntegrableOn U coordinateHamiltonian + /-- A Hamiltonian system is Liouville integrable on a coordinate domain when that domain lies inside the system's domain and, for every time, the system agrees there with an autonomous coordinate Hamiltonian satisfying the Liouville integrability conditions. -/ def HamiltonianSystem.IsLiouvilleIntegrableOn {d : ℕ} (S : HamiltonianSystem 𝓘(ℝ, EuclideanSpace ℝ (Fin d)) ⟨EuclideanSpace ℝ (Fin d)⟩) (U : Set (EuclideanSpace ℝ (Fin d) × EuclideanSpace ℝ (Fin d))) : Prop := - ∃ H, Nonempty (LiouvilleIntegrableOn U H) ∧ - (∀ p q, (p, q) ∈ U → PhaseSpace.ofInnerProductSpace p q ∈ S.domain) ∧ - ∀ t p q, (p, q) ∈ U → S.hamiltonian (t, PhaseSpace.ofInnerProductSpace p q) = H p q + Nonempty (S.LiouvilleIntegrabilityData U) /-! diff --git a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean index b6dba63b2a..71bc6f3e07 100644 --- a/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean +++ b/PhyslibAlpha/ClassicalMechanics/LiouvilleIntegrable/CentralForce.lean @@ -248,10 +248,14 @@ noncomputable def liouvilleIntegrable : coordinate domain of integrability. -/ lemma toHamiltonianSystem_isLiouvilleIntegrableOn : S.toHamiltonianSystem.IsLiouvilleIntegrableOn integrabilityDomain := by - refine ⟨S.hamiltonian, ⟨S.liouvilleIntegrable⟩, ?_, ?_⟩ - · intro p q hpq - exact (S.mem_domain_toHamiltonianSystem p q).2 (snd_ne_zero_of_mem_integrabilityDomain hpq) + refine ⟨{ + coordinateHamiltonian := S.hamiltonian + hamiltonian_eq := ?_ + domain_subset := ?_ + integrable := S.liouvilleIntegrable }⟩ · intro t p q _ exact S.toHamiltonianSystem_hamiltonian t p q + · intro p q hpq + exact (S.mem_domain_toHamiltonianSystem p q).2 (snd_ne_zero_of_mem_integrabilityDomain hpq) end ClassicalMechanics.CentralForce